Solution: Displaying EXIF meta data

matadler

Joined: 2003-01-23
Posts: 11
Posted: Sat, 2003-03-08 00:29

OK guys & gals,

here comes my suggestion for displaying EXIF meta data for a photo. It will be displayed below each photo in single photo view.
It's not very pretty right now, if someone could sort out those nasty nested tables I would be grateful for seeing the solution.
To get an idea what it looks like check out one of my pics: <!-- BBCode Start --><A HREF="http://www.matadler.de/gallery/RoadSigns/2001_10_10_10_50_50" TARGET="_blank">Sample photo with EXIF info</A><!-- BBCode End -->

Here's how to do it:
Save the following as 'inline_photo.footer' in your 'gallery/html_wrap' directory:
<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE>
<?php
$photo = $gallery->album->getPhoto($GLOBALS["index"]);
$photoPath = $gallery->album->getAlbumDir("full");
$mat = $photoPath . "/" . $photo->image->name . "." . $photo->image->type;

list($status, $myExif) = getExif($mat);
if ($myExif) {
?>

<table>
EXIF Data:<BR>
<span class="caption">
<?php
while (list($key, $value) = each ($myExif)) {
// if ($key == "File size") print $key . " " . $value . "<BR>";
if ($key == "Resolution") matfunc ($key, $value);
// if ($key == "Camera make") matfunc ($key; $value);
if ($key == "Camera model") matfunc ($key, $value);
if ($key == "Flash used") matfunc ($key, $value);
if ($key == "Focal length") matfunc ($key, $value);
if ($key == "Exposure time") matfunc ($key, $value);
if ($key == "Aperture") matfunc ($key, $value);
if ($key == "Comment") matfunc ($key, $value);
}
}
?>

<?php

function matfunc ($arg_1, $arg_2)
{
print "<tr><td valign=top><B>" . $arg_1 . ":</B></td><td>" . $arg_2 . "</td></tr>";
}

?>
</span>
</table>
</TD></TR></TABLE><!-- BBCode End -->

Alter the code as needed. BTW, I discovered most of the EXIF source in some other thread, my thanks go there

Cheers Mathias

 
joshcali

Joined: 2007-10-03
Posts: 19
Posted: Thu, 2009-02-05 19:21

I tried this but it doesn't work for me :( all I get is the "code" line and the underline below it. is there any good way to debug this?

thanks!
-Josh