Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2   Go Down

Author Topic: Pictures sorting in lines inside one album  (Read 7937 times)

0 Members and 1 Guest are viewing this topic.

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Pictures sorting in lines inside one album
« 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?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Pictures sorting in lines inside one album
« Reply #1 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?
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #2 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
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #3 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Pictures sorting in lines inside one album
« Reply #4 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".
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #5 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
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #6 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Pictures sorting in lines inside one album
« Reply #7 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;
        }
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #8 on: June 28, 2012, 08:25:09 pm »

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

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Pictures sorting in lines inside one album
« Reply #9 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.
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #10 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.
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Re: Pictures sorting in lines inside one album
« Reply #11 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).
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #12 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
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Pictures sorting in lines inside one album
« Reply #13 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?
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Pictures sorting in lines inside one album
« Reply #14 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.
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #15 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 !!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15759
Re: Pictures sorting in lines inside one album
« Reply #16 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;
        }
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #17 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)?
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Logged

qba

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 56
Re: Pictures sorting in lines inside one album
« Reply #19 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
Logged
Pages: [1] 2   Go Up
 

Page created in 0.028 seconds with 20 queries.