sort by exif field date time taken

Phoca Gallery - image gallery extension
OlivierToebosch
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 16 Jan 2021, 23:43

sort by exif field date time taken

Post by OlivierToebosch »

Hello, I intend to give some users the possibility to upload images. Several people, same event.
i'd like to have the gallery show the images intermingled, in the right historic order, when different people do an upload. either I missed this somewhere but, I cannot see how I can sort on the exif fields.
thx for the tips!
Best regards, Olivier
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: sort by exif field date time taken

Post by Jan »

Hi, sorting is based on database items. So date is a date of upload/add to the system. Setting date base on EXIF needs to be customized directly in the code :idea:

Jan
If you find Phoca extensions useful, please support the project
OlivierToebosch
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 16 Jan 2021, 23:43

Re: sort by exif field date time taken

Post by OlivierToebosch »

So, if I understand and read between the lines here, altough the data is available in the image file, it is not possible to sort on it.
Can I add a field to an image record?
Can I fill this field with an exif field (by other means obviously). Maybe through a sql query...?
Can I use that added field as sorting field?

thx Jan!
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: sort by exif field date time taken

Post by Jan »

Hi, generally (not only applied by Phoca Gallery), when you ask data from database, then you define the sorting and your database will return you the data from database sorted by defined sorting. This has nothing to do with the files on your server, it is just about database.

So if you want to order/sort by date set in filename, you need to move this to database record, for example:

- when image is uploaded to your server
- you will read the date from exif
- file is stored on your server and the item is stored in database (and instead of "now" date you will use the date read from the file when storing data to database)

So when you want to order by date set in EXIF of the file, you need to read it and store to database because as default data from EXIF or form file itself are not stored in database, they are inside the filename. In database you have all the aditional data - title, alias, date, ...

And as it is not so easy, Phoca Gallery has independent database and filesystem layer, becaust it can happen, that you have two images e.g. in two different categories but both of them use the same original file on the server.

Jan
If you find Phoca extensions useful, please support the project
OlivierToebosch
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 16 Jan 2021, 23:43

Re: sort by exif field date time taken

Post by OlivierToebosch »

Maybe I should just ask the users to rename the files according to dateTime taken from exif.
Thx
Olivier
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 47887
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: sort by exif field date time taken

Post by Jan »

Yes, if the format will be right, you can then sort by title which in fact will be the same like by date.
If you find Phoca extensions useful, please support the project
Post Reply