Date added + sorting the pictures problem Date added + sorting the pictures problem
 

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 added + sorting the pictures problem

Started by mietp, September 21, 2004, 10:41:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mietp

Hi,

This seems to be very noobish question, but I really dont know how to fix this. I have tried to search and read + read all the documents. Im loosing my nerves, because I have tried all tricks for several hours. Please some one help me.

I am trying to set up a new gallery with 4 albums in it. I have taken pictures with my camera for past two years and I would like them to show in the gallery by the shoot day. I have changed both mtime and ctime in the db to correspond the shooting date. By doing this I can make ' Date added'  to print exactly the way I want.

The problem, however, is that when I try to sort the pictures by date, the album shows first the picture that is taken 24 th of aug, second the picture that is taken 21th of sep, 3rd the picture that is taken 24 th of aug and 4th the picture that is taken 21th sep. Why is this happening? Please see this link to my album, to get the idea:  http://www.pisara.net/cpg1.2.0final/thumbnails.php?album=4

What is the right way to make a new gallery with old pictures and change the date added times so that they print right and the sorting works, too? All the files are uploaded to the server today. But db shows the right shooting days both in mtime and in ctime.

Sorry for my bad English.

Nibbler

Sorting by date ascending is actually implemented by sorting by the 'pid' ascending, so it is in fact going to be ordered by upload date. Try this:

functions.inc.php

$sort_array = array('na' => 'filename ASC', 'nd' => 'filename DESC', 'ta'=>'title ASC', 'td'=>'title DESC', 'da' => 'pid ASC', 'dd' => 'pid DESC');
       


switch to

$sort_array = array('na' => 'filename ASC', 'nd' => 'filename DESC', 'ta'=>'title ASC', 'td'=>'title DESC', 'da' => 'ctime ASC', 'dd' => 'ctime' DESC');
       


I haven't tested it though.

mietp

Quote from: Nibbler on September 21, 2004, 10:53:40 PM
Sorting by date ascending is actually implemented by sorting by the 'pid' ascending, so it is in fact going to be ordered by upload date. Try this:

Thanks for the quick reply.

Do you mean that the date is goming from the file (ftp) server, not from the db? If its so, is there a way to change files timestamp at the unix shell instead of changing the code?

mietp

Sorry. Now I see what you meant. Theres a 'pid' value in the db. I try to change the code as you told.

Casper

You are using a very out of date version of coppermine.  I suggest you update to version 1.3.2.

There are many reasons to do this, many improvements and bug fixes, but another one for you, if your pictures have exif info, is that there is a mod to sort by exif date.

Updating is very easy, just download the zip file from the downloads section, unzip it, then replace all the files on your server with the new ones.  Simple as that.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

mietp

Quote from: Casper on September 21, 2004, 11:10:27 PM
You are using a very out of date version of coppermine.  I suggest you update to version 1.3.2.

There are many reasons to do this, many improvements and bug fixes, but another one for you, if your pictures have exif info, is that there is a mod to sort by exif date.

Updating is very easy, just download the zip file from the downloads section, unzip it, then replace all the files on your server with the new ones.  Simple as that.

Well.. I updated it and I couldnt access my site anymore. Its not lots of work to do, because I havent done that many changes yet. Now its the newest version then. Batch add files seems not to work? It just says that I have to choose a folder, but theres no way to choose any... Is this a bug or Im I missing some setting here?

Ill have to look that mod out.

Thanks

Tranz

The problem is that you put the photos in userpics. Before v1.3, users were able to get away with it, but 1.3 enforces the rule by preventing the folder from showing up in the batch upload listing. Upload photos in to folders in albums, but not in userpics.

mietp

Quote from: TranzNDance on September 21, 2004, 11:59:33 PM
The problem is that you put the photos in userpics. Before v1.3, users were able to get away with it, but 1.3 enforces the rule by preventing the folder from showing up in the batch upload listing. Upload photos in to folders in albums, but not in userpics.

WoW! It did the trick. Now it works. Have you any good tips how I could sort the pictures with date coming from the exif data?

Tranz

I'm glad that part worked.

As Casper had written, there is a mod to sort by EXIF date. Please do a search.

mietp

Thanks for the all advices I have gotten this far. You are great!

I did as Nibbler told me and now my albums works very smootly and just the way I want to. Great advice.

So, I did change all the ctimes on the DB and now ' Date added'  shows the right date and because of the script editing, sorting by date works too.

Theres only one problem left. Main pages ' Last Additions' shows wrong pictures. Where can I change to sort these pictures by ctime?

Nibbler

Similar idea, functions.inc.php

$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");

change the ORDER BY from pid DESC to ctime DESC

mietp

WoW  ;D

Thank you VEEEERY much. Im so happy that it finally works. Thanks for helping me out. I knew that the line was somewhere, but it had taken ages for me to find the right one.

This case is solved and the thread can be locked.