Advanced search  

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

Pages: [1]   Go Down

Author Topic: Date sort  (Read 2644 times)

0 Members and 1 Guest are viewing this topic.

christfort

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Date sort
« on: May 24, 2011, 01:55:31 pm »

I'm using cpg 1.5.12 Revision: 8154.

As suggested by others I've added a field pdate to the database, holding the shooting date and time of the photo. This field is filed from exif data during upload. Inorder to sort on this filed, I have modified functions.inc.php line 1296 and 1297 as follows:

        $sort_array = array(

            'na' => "filename $ASC, pid $ASC",

            'nd' => "filename $DESC, pid $DESC",

            'ta' => "title $ASC, pid $ASC",

            'td' => "title $DESC, pid $DESC",

            'da' => "ptime $ASC, pid $ASC",

            'dd' => "ptime $DESC, pid $DESC",

            'pa' => "position $ASC, pid $ASC",

            'pd' => "position $DESC, pid $DESC",

        );

Selecting sort by date I get the expected result, thumbnails are correctly sorted by the ptime, however when I click on a thumbnail a totally different photo is selected. When using any other sort the correct picture is selected. Does anyone know what I have done wrong?

I include my modified functions.inc.php file.

Thomas Christfort
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Date sort
« Reply #1 on: May 24, 2011, 02:01:20 pm »

Please try what happens when you adjust the sort array inside the function get_pic_pos.
Logged

christfort

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Date sort
« Reply #2 on: May 24, 2011, 02:21:36 pm »

I take it that you mean this:

   $sort_array = array(

        //'na' => 'filename <',

        //'nd' => 'filename >',

        //'ta' => 'title <',

        //'td' => 'title >',

        'da' => 'pid <',

        'dd' => 'pid >',

        //'pa' => 'position <',

        //'pd' => 'position >',

    );

Excuse my ignorance but, how should it be modified? When I do this:


   $sort_array = array(

        //'na' => 'filename <',

        //'nd' => 'filename >',

        //'ta' => 'title <',

        //'td' => 'title >',

        'da' => 'ptime <',

        'dd' => 'ptime >',

        //'pa' => 'position <',

        //'pd' => 'position >',

    );

Then always the first photo in the album is selected.

Thomas
Logged

christfort

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
Re: Date sort
« Reply #3 on: May 24, 2011, 09:06:33 pm »

When I comment out the two lines 'da' and 'dd' so the sort_array is empty like this:

 $sort_array = array(

        //'na' => 'filename <',

        //'nd' => 'filename >',

        //'ta' => 'title <',

        //'td' => 'title >',

        //'da' => 'ptime <',

        //'dd' => 'ptime >',

        //'pa' => 'position <',

        //'pd' => 'position >',

    );

everything seems to work right. Does anyone know whether it is safe to do this??

Thomas
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Date sort
« Reply #4 on: May 25, 2011, 08:59:55 am »

The function get_pic_pos has been introduced while the parameter pos has been replaced with pid, which caused a performance penalty for albums with a lot of files (like some meta albums, e.g. lastup). Please test your gallery as thoroughly as you can. If everything works as expected your solution should be fine. If not we have to look closer at your modification.
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 19 queries.