forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: qba on June 28, 2012, 11:18:51 am

Title: Pictures sorting in lines inside one album
Post by: qba on June 28, 2012, 11:18:51 am
Hello,

I`m using CP gallery to present my brochure collection. Order sorting is: World Area (categories) -> Brand (albums). Inside albums I`m presenting brochures. To make more readable I`d like to sort pictures: each model starts from new line (blank fields from previous line should be filled in by something transparent till end of that line). Maybe another sollution will be better (?)

Is it possible to make?
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 28, 2012, 01:35:02 pm
How exactly should Coppermine determine when a model ends and the next begins? What happens if there are more pictures for a model than available columns?
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 28, 2012, 01:42:47 pm
You understood me wrong. I know which models should be divided. And I`ll do it "manually"
The question is: how to divide chosen pictures between lines?
My idea is to insert between chosen pictures transparent object to fill in the fields in table (but this object must be missed in "Last add" category). But I don`t know how to make this kind of object
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 28, 2012, 01:49:14 pm
Or second idea: to make special command which make new table (in the same album) below the previous one.
I think second idea is much difficult and impossible to implement
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 28, 2012, 01:56:11 pm
insert between chosen pictures transparent object to fill in the fields in table
I assume the easiest solution will be to upload transparent pictures.


this object must be missed in "Last add" category
That is quite easy by adjusting $RESTRICTEDWHERE just before we use it in the meta albums. But we need some static information how we can exclude them from the query, e.g. by adding to all of that objects the keyword "blank".
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 28, 2012, 02:29:29 pm
I assume the easiest solution will be to upload transparent pictures.

That is quite easy by adjusting $RESTRICTEDWHERE just before we use it in the meta albums. But we need some static information how we can exclude them from the query, e.g. by adding to all of that objects the keyword "blank".

Good idea. The transparent picture should have constant name, reserved only for this object. Then script can easy recognise that this is special object, not picture
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 28, 2012, 02:39:27 pm
If it`s possible we can make a step forward: whes script "meet" that special object after picture, then automatically fill in rest of fields in this concrete line. This sollution permits to use only one object regardless of how many fields is after chosen picture till end of line in table
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 28, 2012, 03:45:38 pm
Copy the function theme_display_thumbnails from themes/sample/theme.php to your theme's theme.php file, if it doesn't exist. Then, find
Code: [Select]
foreach($thumb_list as $thumb) {and above, add
Code: [Select]
$count = count($thumb_list);
find
Code: [Select]
        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }
and replace with
Code: [Select]
        if (stripos($thumb['filename'], 'separator') !== FALSE) {
            while ($i % $thumbcols != 0) {
                $i++;
                $count++;
                echo $empty_cell;
            }
        }

        if ((($i % $thumbcols) == 0) && ($i < $count)) {
            echo $row_separator;
        }
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 28, 2012, 08:25:09 pm
Done! Thank you.
But what next? How to sort my pictures?
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 29, 2012, 08:39:09 am
The current code searches for files which contains the string "separator"
Quote
if (stripos($thumb['filename'], 'separator') !== FALSE) {

You can of course change that string to your needs. Depending on your default thumbnail sort order you have to move the "object(s)" to it's desired place(s).

If it works as expected the next step will be to exclude those objects from the meta albums.
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 29, 2012, 09:06:01 am
It works! See: http://www.car-brochures.one.pl/thumbnails.php?album=190 Thank you

But on Start page - below - I have section "Last add" with 4 files. Now I see only 3 files.
Title: Re: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 29, 2012, 09:21:21 am
Please read what I already wrote
the next step will be to exclude those objects from the meta albums.
by
adjusting $RESTRICTEDWHERE just before we use it in the meta albums


So please, open include/functions.inc.php, find
Code: [Select]
switch($album) {and above, add
Code: [Select]
$RESTRICTEDWHERE .= " AND filename NOT LIKE '%separator%' ";(at two places in that file).
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 29, 2012, 02:17:54 pm
I read it but I didn`t know how to do it in PHP code. At evening I`ll modify code.

I have two additional questions to make better:
1) is it possible to make "invisible" separator for website counter (quantity of images)?
2) now to make much readable order in album I`m using doubble separators (blank fields till end of line + one line free). Is it possible to separator filling empty fields till end of line (as it is currently) and one line below?

Something like this (here I used doubble separators):
http://car-brochures.one.pl/thumbnails.php?album=49
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 29, 2012, 02:44:35 pm
Is it possible to separator filling empty fields till end of line (as it is currently) and one line below?

Undo that code change:
find
Code: [Select]
        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }
and replace with
Code: [Select]
        if (stripos($thumb['filename'], 'separator') !== FALSE) {
            while ($i % $thumbcols != 0) {
                $i++;
                $count++;
                echo $empty_cell;
            }
        }

        if ((($i % $thumbcols) == 0) && ($i < $count)) {
            echo $row_separator;
        }

instead, find
Code: [Select]
        echo template_eval($thumb_cell, $params);

        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }
and replace with
Code: [Select]
        if (stripos($thumb['filename'], 'separator') !== FALSE) {
            echo $empty_cell;
            while ($i % $thumbcols != 0) {
                $i++;
                $count++;
                echo $empty_cell;
            }
            echo $row_separator;
            for ($j = 0; $j < $thumbcols; $j++) {
                echo $empty_cell;
            }
        } else {
            echo template_eval($thumb_cell, $params);
        }

        if ((($i % $thumbcols) == 0) && ($i < $count)) {
            echo $row_separator;
        }

That code also hides the separator itself, so your users won't be able to click on it.


is it possible to make "invisible" separator for website counter (quantity of images)?
I guess you want to exclude the separator objects from the website stats, right?
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 29, 2012, 02:48:44 pm
Just had another idea to avoid the whole meta album and stats issues. Why don't you just append "separator" to the last image's file name of each block? This way it also separates as desired, but we avoid those extra files. Of course my last code suggestion has to be adjusted slightly, as it currently hides the separator file.
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 29, 2012, 03:16:04 pm
You`re right! It`s really easiest way.
Look: http://car-brochures.one.pl/thumbnails.php?album=97 - this result is with first code modification (from yesterday) and works really good.
May you post code which only adds free line below separatod (without hide it)?

Thank you !!
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on June 29, 2012, 03:32:03 pm
To make it easier to read, here the complete mod from scratch.

Copy the function theme_display_thumbnails from themes/sample/theme.php to your theme's theme.php file, if it doesn't exist. Then, find
Code: [Select]
foreach($thumb_list as $thumb) {and above, add
Code: [Select]
$count = count($thumb_list);
find
Code: [Select]
        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }
and replace with
Code: [Select]
        if (stripos($thumb['filename'], 'separator') !== FALSE) {
            while ($i % $thumbcols != 0) {
                $i++;
                $count++;
                echo $empty_cell;
            }
            echo $row_separator;
            for ($j = 0; $j < $thumbcols; $j++) {
                echo $empty_cell;
            }
        }

        if ((($i % $thumbcols) == 0) && ($i < $count)) {
            echo $row_separator;
        }
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 29, 2012, 10:07:43 pm
Works! :)

Is it possible to make more space between picture groups? (f.ex. by enlarge free line to h=50pix or make 3 or 4 free lines)?
Title: Re: Pictures sorting in lines inside one album
Post by: qba on June 29, 2012, 10:08:14 pm
Now it looks: http://car-brochures.one.pl/thumbnails.php?album=97
Title: Re: Pictures sorting in lines inside one album
Post by: qba on July 01, 2012, 10:40:24 pm
Αndré,
During weekend I tested both sollutions: (1) separator as separate photo (invisible for meta albums) and (2) add word 'separator' to file name. Both sollutions have disadvantages.

Sollution 1)
- Photo-Separator is invisible in Album, but on start page in "Last add" each photo-separator means one photo fewer.
- In "Last add" album each photo-separator means first line lower

Sollution 2)
- It`s unconfortable to upload new photos because by each upload it`s necessary to delete 'separator' word from last file and add to new file which now is the last one in concrete group
- In "Last add" album after file with 'separator' word line is empty and files are continue from new line below

I think the nearest to perfection is sollution no 1 but now I have no idea how to do it
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on July 02, 2012, 09:26:27 am
I have no idea how to do it
What exactly is to do, except excluding the separator files from the gallery stats?
Title: Re: Pictures sorting in lines inside one album
Post by: qba on July 02, 2012, 09:43:23 am
Photo-separator actually is not visible in Last add album but has an effect on the rest photos in that album (in Last add album, in last add section on home page, in last add section in categories). Compare attached screens.

So to do is:
- exclude photo-separator from gallery stats
- exclude effect (impact) the photo-separator from Last add album and Last add section
- if its possible: after photo-separator make one line below free with high f.ex. 20 pix
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on July 02, 2012, 09:54:30 am
exclude effect (impact) the photo-separator from Last add album and Last add section

open include/functions.inc.php, find
Code: [Select]
switch($album) {and above, add
Code: [Select]
$RESTRICTEDWHERE .= " AND filename NOT LIKE '%separator%' ";(at two places in that file).
Title: Re: Pictures sorting in lines inside one album
Post by: qba on July 02, 2012, 10:07:04 pm
Sorry, I overlooked it.
It works of course.

And is it possible or not?
Quote
after photo-separator make one line below free with high f.ex. defined 20 pix or high=high of photo-separator
Title: Re: Pictures sorting in lines inside one album
Post by: Αndré on July 03, 2012, 08:41:25 am
exclude photo-separator from gallery stats
Open index.php, find
Code: [Select]
            $sql = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']}";

            if ($pic_filter) {
                $sql .= " AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE approved = 'YES' $pic_filter";
            } else {
                $sql .= " WHERE approved = 'YES'";
            }
and below, add
Code: [Select]
$sql .= " AND filename NOT LIKE '%separator%' ";

after photo-separator make one line below free with high f.ex. 20 pix
In that solution (http://forum.coppermine-gallery.net/index.php/topic,75118.msg361850.html#msg361850), find
Code: [Select]
            for ($j = 0; $j < $thumbcols; $j++) {
                echo $empty_cell;
            }
and replace with
Code: [Select]
            for ($j = 0; $j < $thumbcols; $j++) {
                echo str_replace('<td ', '<td height="20" ', $empty_cell);
            }
Title: Re: Pictures sorting in lines inside one album
Post by: qba on July 03, 2012, 09:55:29 pm
All is OK  ;D

Thank you for your support  :D