exif date from image in gallery

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

exif date from image in gallery

Post by sonichouse »

I am using Highslide JS in a static page for my photo album.

I currently hard code the date in the title attribute e.g.

Code: Select all

<a id="thumb5" href="/serendipity/uploads/photos/DSC00142.JPG" class="highslide" onclick="return hs.expand(this)">
	<img src="/serendipity/uploads/photos/DSC00142.thumb.JPG" alt="Highslide JS" 
		title="<b>22-Aug-2006:</b> Tara being stalked by a heron in the Maldives." height="82" width="110" /></a>

<a id="thumb6" href="/serendipity/uploads/photos/DSC00379.JPG" class="highslide" onclick="return hs.expand(this)">
	<img src="/serendipity/uploads/photos/DSC00379.thumb.JPG" alt="Highslide JS" 
		title="<b>14-May-2007:</b> The folks having fun in the sun after my brother's wedding in Cyprus." height="82" width="110" /></a>
If I know the image ID, how do I use the EXIF date information instead of hardcoding it ?
Steve is occasionally blogging here
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: exif date from image in gallery

Post by garvinhicking »

Hi!

Short answer: You can't.

Long answer: You would need to write your own Smarty function and register that in your template's config.inc.php, and then install the "Smarty markup" event plugin so that you can use smarty markup in your static pages. Then you could enter a code like:

Code: Select all

{makeGallery name="photos/DSC00142.jpg"}
and your templates config.inc.php would look something like this:

Code: Select all

function makeGallery($params, &$smarty) {
   global $serendipity;
   $res =  serendipity_db_query("SELECT * FROM {$serendipity['dbPrefix']}images WHERE CONCAT(path, '/', name, '.', extension) = '" . serendipity_db_escape_string($params['name']) . '");
   // print_r($res);
   // More code here, access the functions of the include/functions_images.inc.php API
}

$serendipity['smarty']->register_function('makeGallery', 'makeGallery');
The makeGallery function could use the s9y API methods to access metadata (I believe you don't need my query at all, there should be a s9y function that can fetch an image by filename).

HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Thanks for that.

I'll stick with it manually for now until a Highslide plugin arrives :lol:
Steve is occasionally blogging here
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Incidentally, Don was working on EXIF tags for his site. As I recall, we discovered that the PHP support for EXIF is very spotty, despite being included as a standard extension.

I wouldn't hold my breath or anything.

But maybe Don will have something to add to the discussion.
Judebert
---
Website | Wishlist | PayPal
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

judebert wrote:Incidentally, Don was working on EXIF tags for his site. As I recall, we discovered that the PHP support for EXIF is very spotty, despite being included as a standard extension.

I wouldn't hold my breath or anything.

But maybe Don will have something to add to the discussion.
Thanks, the extended info in the media library seemed to be populated with the correct information. Guess I was lucky :wink:
Steve is occasionally blogging here
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

I have not messed with that in awhile - as Judebert mentioned, EXIF and IPTC support seems to vary considerably from one php install to another.

However, in this case, I am wondering if sonichouse could install the serendipity_event_imageselectorplus plugin then use its smarty variable $quickblog.exif.Date_Time? ie, something like this:

Code: Select all

<a id="thumb5" href="/serendipity/uploads/photos/DSC00142.JPG" class="highslide" onclick="return hs.expand(this)">
   <img src="/serendipity/uploads/photos/DSC00142.thumb.JPG" alt="Highslide JS"
      title="<b>{$quickblog.exif.Date_Time:</b&gt}; Tara being stalked by a heron in the Maldives." height="82" width="110" /></a>
I have no idea if that would work, but maybe its a step in the right direction (or, quite possibly, 3 steps in the WRONG direction)!! LOL
=Don=
sonichouse
Regular
Posts: 196
Joined: Sun May 11, 2008 2:53 am
Contact:

Post by sonichouse »

Don Chambers wrote:I have no idea if that would work, but maybe its a step in the right direction (or, quite possibly, 3 steps in the WRONG direction)!! LOL
I think at the moment this is just too far down the garden path for me as I have just started to learn to walk :P

However, when/if I get up to pace then I will revisit this.

Thanks all.

/Steve
Steve is occasionally blogging here
Post Reply