coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: mietp on September 21, 2004, 10:41:15 PM

Title: Date added + sorting the pictures problem
Post by: mietp on September 21, 2004, 10:41:15 PM
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.
Title: Re: Date added + sorting the pictures problem
Post by: 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:

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.
Title: Re: Date added + sorting the pictures problem
Post by: mietp on September 21, 2004, 10:59:04 PM
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?
Title: Re: Date added + sorting the pictures problem
Post by: mietp on September 21, 2004, 11:00:58 PM
Sorry. Now I see what you meant. Theres a 'pid' value in the db. I try to change the code as you told.
Title: Re: Date added + sorting the pictures problem
Post by: 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.
Title: Re: Date added + sorting the pictures problem
Post by: mietp on September 21, 2004, 11:54:29 PM
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
Title: Re: Date added + sorting the pictures problem
Post by: Tranz 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.
Title: Re: Date added + sorting the pictures problem
Post by: mietp on September 22, 2004, 12:07:53 AM
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?
Title: Re: Date added + sorting the pictures problem
Post by: Tranz on September 22, 2004, 12:15:45 AM
I'm glad that part worked.

As Casper had written, there is a mod to sort by EXIF date. Please do a search.
Title: Re: Date added + sorting the pictures problem
Post by: mietp on September 22, 2004, 07:28:05 PM
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?
Title: Re: Date added + sorting the pictures problem
Post by: Nibbler on September 22, 2004, 07:45:57 PM
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
Title: Re: Date added + sorting the pictures problem
Post by: mietp on September 22, 2004, 07:59:07 PM
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.