Pictures sorting in lines inside one album Pictures sorting in lines inside one album
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Pictures sorting in lines inside one album

Started by qba, June 28, 2012, 11:18:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

qba

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?

Αndré

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?

qba

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

qba

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

Αndré

Quote from: qba on June 28, 2012, 01:42:47 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.


Quote from: qba on June 28, 2012, 01:42:47 PM
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".

qba

Quote from: Αndré on June 28, 2012, 01:56:11 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

qba

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

Αndré

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
foreach($thumb_list as $thumb) {
and above, add
$count = count($thumb_list);

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

and replace with
        if (stripos($thumb['filename'], 'separator') !== FALSE) {
            while ($i % $thumbcols != 0) {
                $i++;
                $count++;
                echo $empty_cell;
            }
        }

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

qba

Done! Thank you.
But what next? How to sort my pictures?

Αndré

The current code searches for files which contains the string "separator"
Quoteif (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.

qba

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.

Αndré

Please read what I already wrote
Quote from: Αndré on June 29, 2012, 08:39:09 AM
the next step will be to exclude those objects from the meta albums.
by
Quote from: Αndré on June 28, 2012, 01:56:11 PM
adjusting $RESTRICTEDWHERE just before we use it in the meta albums


So please, open include/functions.inc.php, find
switch($album) {
and above, add
$RESTRICTEDWHERE .= " AND filename NOT LIKE '%separator%' ";
(at two places in that file).

qba

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

Αndré

Quote from: qba on June 29, 2012, 02:17:54 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:
Quote from: Αndré on June 28, 2012, 03:45:38 PM
find
        if ((($i % $thumbcols) == 0) && ($i < count($thumb_list))) {
            echo $row_separator;
        }

and replace with
        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
        echo template_eval($thumb_cell, $params);

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

and replace with
        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.


Quote from: qba on June 29, 2012, 02:17:54 PM
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?

Αndré

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.

qba

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 !!

Αndré

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
foreach($thumb_list as $thumb) {
and above, add
$count = count($thumb_list);

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

and replace with
        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;
        }

qba

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)?


qba

Α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