We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to sort gallery images by EXIF data?

Development and Programming

Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

I would like my gallery images to be sorted by the ‘datetimeoriginal’ field from the EXIF data.

Can this be done and if so, how do I do it?

Thanks

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

How does everyone else sort their galleries?

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

Would I have to do a custom query for something like that? Would this be a reasonable FR…a custom sort order?

Am I the first person to want this?

       
Lisa Wess's avatar
Lisa Wess
20,502 posts
17 years ago
Lisa Wess's avatar Lisa Wess

Hi, Erin;

The problem is that EE’s gallery doesn’t read EXIF data by default, so there is no orderby option for this. If you’re showing EXIF data it’s probably via Low’s plugin, or another solution I haven’t seen yet. =)

It may be possible to add the orderby= using an extension, otherwise yes, a query might be best, and you’d need to use the query in combination with Low’s plugin. But it will definitely require custom code.

There are requests, already, for EE to be able to handle EXIF data, so you might find one and add your support.

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

I suppose another option would be to write an extension that hooked into the image upload facility and modified the date based on the EXIF info. Then you could use EE’s standard gallery sort mechanism.

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

If I understand things properly, I would use this extension hook to get the exif data and set the date?

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

For those following along, I am going to attempt to tie into the gallery insert entry hook and add the exif data to a new table so that the data can be retrieved later via a plugin (that I will write as well).

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

Does ‘gallery_cp_insert_entry_end’ get called from the Batch Entry?

Mods, please move this to the Extensions forum…more appropriate there me thinks.

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

Answering my own question. Yes, it does get called from the batch entries.

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

Following up:

I finally found some EXIF code that didn’t error out on my Canon-produced images. I wrote an extension that reads the EXIF data and changes the entry’s entry_date to set it to the EXIF original date. This allows me to sort on entry_date and have it be the proper sort.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.