EXIF data in description field
-
Alex
Since I’ve opened the door to a conversation with you, I was wondering if you could help on the above topic.
with the help of my son, we’ve written some php to take some of the exif data and put it into the Description field of the NGG Gallery pages for each image. This then gets shown when using Lightbox ??
The requires adding a line of code to the nextgen-gallery/admin/manage-images.php file to call our function.
The thing is, every time you make a new release, I have to go through and make the change again – and I am sure, one day, you will make a change which will cause my code a problem.
Is there an easy way to do what I would like to do using functions that already exist in NGG?
Here is my code:
<?php /* Add the following code into "wp-content/plugins/nextgen-gallery/admin/manage-images.php" immediately after "foreach($picturelist as $picture) (" around line 378 ish) include ("../wp-content/plugins/exif_for_ngg.php"); */ //GENERATE EXIF STRING AND PREPEND TO $image->description; //$picture = nggdb::find_image($image->pid); $meta = new nggMeta($picture->pid, true); $exifdata = $meta->get_EXIF(); //if (!empty($exifdata["focal_length"])) return false; //$exifstring = $exifdata["camera"].' '.$exifdata["shutter_speed"].' @ '.$exifdata["aperture"].' - , '.$exifdata["focal_length"]; $exifstring=""; if ($exifdata["camera"]) $exifstring .= $exifdata["camera"].' '; if ($exifdata["shutter_speed"]) $exifstring .= $exifdata["shutter_speed"].' @ '; if ($exifdata["aperture"]) { $ap = str_replace(" ", "", $exifdata["aperture"]); $exifstring .= $ap.' '; } if ($exifdata["focal_length"]) $exifstring .= $exifdata["focal_length"].' '; if ($exifdata["iso"]) $exifstring .= ', ISO'.$exifdata["iso"]; if ($exifstring) $exifstring .= ' - '; if ($exifstring) $exifstring .= $exifdata["created_timestamp"].' '; $atsign = strpos($picture->description, "@"); if ($atsign === false) { //No exif yet so insert it $picture->description = $exifstring.$picture->description; } else { //already there so do nothing } ?>
- The topic ‘EXIF data in description field’ is closed to new replies.