Enhanced Simple PHP Gallery IPTC mod

Description

When you add a caption to an image in Google's Picasa/Picasa2 (and other image editing programs) the caption is saved to the actual image in the header section called IPTC data.

There is a script called "Enhanced Simple PHP Gallery" that I use as a gallery for this webpage and many others mainly because its so simple to operate. Normally if you wanted to add a description to a file you would have to use the administration page or manually edit the "sp_descriptions.ini" file. This can take a lot of work and if you ever switch gallery scripts all your descriptions are lost.

What I have done is altered the gallery script to check for the title and description from the IPTC data when it is loading an image.

Download

I have altered the Enhanced Simple PHP Gallery to include my changes. All you should have to do is upload the contents of this zip to your webserver with some images.

espg_1_72_iptc Enhanced Simple PHP Gallery v1.72 with IPTC mod
Files Size: (55k)

Manually

If you have made changes to the Enhanced Simple PHP Gallery you may want to follow these steps.

Step 1:

Download the Enhanced Simple PHP Gallery 1.72 [Local] [Mirror]

Step 3:

Upload The Enhanced Simple PHP Gallery to your webserver

Step 3:

Open sp_def_vars.php
Find

if(eregi(".*(\.jpg|\.gif|\.png|\.jpeg)",basename($_GET['file'])))
    $current = basename($_GET['file']);
else
    exit;

        

Add After


if( empty($descriptions[$current]['desc']) ) {
    $size = getimagesize ( $_SERVER['DOCUMENT_ROOT'] . $display_file, $info);       
    if(is_array($info)) {   
        $iptc = iptcparse($info["APP13"]);
        if(is_array($iptc)) {
            $descriptions[$current]['desc'] = $iptc['2#120'][0];
        }
    }
}
if( empty($descriptions[$current]['title']) ) {
    $size = getimagesize ( $_SERVER['DOCUMENT_ROOT'] . $display_file, $info);       
    if(is_array($info)) {   
        $iptc = iptcparse($info["APP13"]);
        if(is_array($iptc)) {
            $descriptions[$current]['title'] = $iptc['2#005'][0];
        }
    }
}
    

Key words

IPTC, Enhanced Simple PHP Gallery,

Contact and Help/Suggestions/Comments

Written by: Steven Smethurst
Feel free to contact me