Date sort Date sort
 

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

Date sort

Started by christfort, May 24, 2011, 01:55:31 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

christfort

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

Αndré

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

christfort

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

christfort

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

Αndré

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.