<?  // PHPmyGallery - backend core - EXIF Demonstration

/* File description:

This file loads a jpg and displays EXIF data from that picture.

### What this script does:
###
### Included from: adminmenu.index.php
### |
### | (Uses no templates)
### +- EXIF Demo (Load picture, Get EXIF data, Display EXIF data)
###
*/ 

// Settings
$picdir = '.';
$pic    = 'test.jpg';

// Process picture`s EXIF data
if ($picdir!=''&&$pic!=''&&is_file($picdir.'/'.$pic)) {
    $br      = "<br />\n";
    $picture = $picdir.'/'.$pic;
    $exif    = exif_read_data($picture) or die('exif_read_data returned false, it may be not installed correctly or the file is not a .jpg picture.');
    
    $pktpl_vars['template_admin_table'] = '<b>EXIF data for '.$picdir.'/'.$pic.':</b>'.$br;
    foreach($exif as $key=>$section) {
        foreach($section as $name=>$val) {
            $pktpl_vars['template_admin_table'] .= '{$EXIF_'.$key.'_'.$name.'} = \''.$val.'\''.$br;
        } // foreach
    } // foreach
} // if
else {
    $pktpl_vars['template_admin_table'] = 'This script displays the EXIF contents of a jpg file.<br><br>';
    $pktpl_vars['template_admin_table'].= 'Just put a file named "test.jpg" inside the /_conf/ directory';
} // else

?>
