Step 1 – Change the hasExif(), getExifDisplayTool() functions in util.php to support exiftool, and thus make the code cleverer. Also add the right config.php item ($gallery->app->exiftool). Theory states that fixing this one occurence of the eregi test will make life groovy. Well, who tell me say dat!?

Step 2 – Notice that various code in view_photo.php and view_photo_properties.php uses the same eregi code, not the function that exists to determine if the image supports EXIF data. Therefore, even though the core function is now ‘intelligent’ enough to determine if it has exiftool available, and thus how to test if an image contains/supports EXIF data, the rest of Gallery isn’t.

Step 3 – Find all of the occurences in view_photo.php and view_photo_properties.php (that matter for my purposes) of the eregi test, and make it call hasExif() with the full disk path of the image in question. Discover that getPhotoPath should really be called getPhotoURIPath, as it returns the path segment of the URL of the image, not the disk path!

Step 4 – Discover that lib/AlbumItem.php also has the same eregi test. Curse developers for writing a function, and not using it. Patch the code to use the proper function. Viewing a photo page of a non-JPG now displays the little ? icon that Gallery uses to indicate that photo properties are available.

Step 5 – Profit!! Gallery now understands that PNG files can indeed contain EXIF data. The patches to the code are not brilliant, and probably break Gallery if exiftool isn’t installed, but it’s my server, my gallery, so if I screw up, my problem :) For all I know, Gallery 2 fixes this issue, but Gallery 2 doesn’t have mirroring, so I’m not using it yet.

The downside of this support is that I can no longer just apply Gallery upgrades as they come out – I have to do it by hand, or do the upgrade and re-apply my patches for this issue, and the patches for disabling the click counter for certain IPs – I don’t want clicks from my IP address, as I verify everything is right and add captions etc, to count towards the total number of clicks an image receives. The patches should work with 1.5.2, but I’m not in the mood to upgrade and test!