Ascending sort thumbnails by a custom numeric field Ascending sort thumbnails by a custom numeric field
 

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

Ascending sort thumbnails by a custom numeric field

Started by dimangelid, January 27, 2019, 10:14:00 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

dimangelid

Hello,

I have installed version 1.5.46 at my website. We have setup some custom fields and our users complete them when uploading any photo.

Now we want to ascending sort thumbnails on all albums by one of these fields, which is numeric. Such option is not available at gallery settings.

Is anyone aware how can i achieve that?

dimangelid

Quote from: dimangelid on January 27, 2019, 10:14:00 PM
Hello,

I have installed version 1.5.46 at my website. We have setup some custom fields and our users complete them when uploading any photo.

Now we want to ascending sort thumbnails on all albums by one of these fields, which is numeric. Such option is not available at gallery settings.

Is anyone aware how can i achieve that?

Hello again,
Is anybody aware on how to achieve that?

phill104

It is a mistake to think you can solve any major problems just with potatoes.

ΑndrĂ©

I assume you're talking about that option: https://documentation.coppermine-gallery.net/en/configuration.htm#admin_thumbnail_default_sortorder

The probably easiest way would be to set that value to "Position ascending" and create a small script that updates the value of the position field with the value of your custom field (I can provide such a script, if you cannot create it yourself). Of course this script needs to be run regularely (e.g. with a cronjob) to update any changes in the custom fields or if new files are added to your gallery. Alternatively you could modify the Coppermine code to use the custom field instead of the position field, but modifying core files is not recommended.