Topic: Add EXIF Data To Photo

For those who are planning to modify the buildgallery.php to include the picture EXIF information, here is a sample code. I incorporate it in my buildgallery.php

     //Obtain EXIF Information From Pictures
     $exif_file = "./".$dirfile."/images/".$key;
     $exif = exif_read_data($exif_file, EXIF, TRUE);
    foreach ($exif as $key1 => $section1) {
      foreach ($section1 as $name1 => $val) {
        echo "$key1.$name1&#58; $val<br />n";
        if &#40;$name1 == "ApertureFNumber" && $key1 == "COMPUTED"&#41; &#123;
            $ApertureFNumber = "ApertureFNumber&#58; ".$val;
            
        &#125; elseif &#40;$name1 == "ExposureTime" && $key1 == "EXIF"&#41; &#123;
            list&#40;$a, $b&#41; = split &#40;"/", $val&#41;;
            $ab = $b / $a;
            $ExposureTime = "ExposureTime&#58; 1/".$ab;
        &#125;

Using the $AperturnFName and $ExposureTime info obtained above, I past it into the <CAPTION> tag

$xml .= '<CAPTION><!&#91;CDATA&#91;<A href="'.$linkpath.''.$key.'" target="_blank" class="xmlcaption"><center><b>OPEN LARGER IMAGE&#58; '.$key.'<br>'.$ApertureFNumber.'<br>'.$ExposureTime.'<br></b><center></A>&#93;&#93;></CAPTION>'.$carreturn;

Sample Availabe "FIELDS" for you to pull out off a picture from EXIF tag.

FILE.FileName: boi-07.jpg
FILE.FileDateTime: 1148402885
FILE.FileSize: 136834
FILE.FileType: 2
FILE.MimeType: image/jpeg
FILE.SectionsFound: ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP
COMPUTED.html: width="667" height="519"
COMPUTED.Height: 519
COMPUTED.Width: 667
COMPUTED.IsColor: 1
COMPUTED.ByteOrderMotorola: 1
COMPUTED.ApertureFNumber: f/4.0
COMPUTED.UserComment: K. NGUYEN-TU - PHOTOGRAPHY
COMPUTED.UserCommentEncoding: ASCII
COMPUTED.Thumbnail.FileType: 2
COMPUTED.Thumbnail.MimeType: image/jpeg
IFD0.Make: NIKON CORPORATION
IFD0.Model: NIKON D200
IFD0.Orientation: 1
IFD0.XResolution: 720000/10000
IFD0.YResolution: 720000/10000
IFD0.ResolutionUnit: 2
IFD0.Software: Adobe Photoshop CS2 Windows
IFD0.DateTime: 2006:05:23 09:48:04
IFD0.YCbCrPositioning: 2
IFD0.Exif_IFD_Pointer: 240
IFD0.GPS_IFD_Pointer: 896
THUMBNAIL.Compression: 6
THUMBNAIL.XResolution: 72/1
THUMBNAIL.YResolution: 72/1
THUMBNAIL.ResolutionUnit: 2
THUMBNAIL.JPEGInterchangeFormat: 1010
THUMBNAIL.JPEGInterchangeFormatLength: 4747
EXIF.ExposureTime: 10/600
ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ----- ExposureTime: 1/60EXIF.FNumber: 40/10
EXIF.ExposureProgram: 2
EXIF.ISOSpeedRatings: 400
EXIF.ExifVersion: 0221
EXIF.DateTimeOriginal: 2006:05:22 19:24:03
EXIF.DateTimeDigitized: 2006:05:22 19:24:03
EXIF.ComponentsConfiguration: 
EXIF.CompressedBitsPerPixel: 4/1
EXIF.ExposureBiasValue: 2/6
EXIF.MaxApertureValue: 30/10
EXIF.MeteringMode: 5
EXIF.LightSource: 0
EXIF.Flash: 0
EXIF.FocalLength: 750/10
EXIF.UserComment: ASCIIK. NGUYEN-TU - PHOTOGRAPHY
EXIF.SubSecTime: 08
EXIF.SubSecTimeOriginal: 08
EXIF.SubSecTimeDigitized: 08
EXIF.FlashPixVersion: 0100
EXIF.ColorSpace: 1
EXIF.ExifImageWidth: 667
EXIF.ExifImageLength: 519
EXIF.InteroperabilityOffset: 864
EXIF.SensingMethod: 2
EXIF.FileSource: 
EXIF.SceneType: 
EXIF.CFAPattern: 
EXIF.CustomRendered: 1
EXIF.ExposureMode: 0
EXIF.WhiteBalance: 0
EXIF.DigitalZoomRatio: 1/1
EXIF.FocalLengthIn35mmFilm: 112
EXIF.SceneCaptureType: 0
EXIF.GainControl: 1
EXIF.Contrast: 0
EXIF.Saturation: 2
EXIF.Sharpness: 2
EXIF.SubjectDistanceRange: 0
GPS.GPSVersion: 
INTEROP.InterOperabilityIndex: R98
INTEROP.InterOperabilityVersion: 0100

I should have an updated sample to viewed at http://www.knguyentu.com after July 1st. I am working on redesigning my website to incorporate this functionality....

[url]http://www.photographybykevin.net[/url]

Simple Viewer FAQ By Kevin
[url]http://knguyentu.com/wordpress/photography-by-kevin/simpleviewer-flash-photo-gallery/[/url]

Re: Add EXIF Data To Photo

Hello,

Can you tell me where exactly the code must be put.
When I insert the it, I get an error.

Thanx in advance.

Re: Add EXIF Data To Photo

Hi...

I got a working version up and running for anyone who is interested in seeing.....

http://www.photographybykevin.net

Look at the picture gallery and click on anyone of the pictures you will see the EXIF info at the bottom.

Here is a full buildgallery.php. You might need to make some minor modification to it, but for the most part it is complete to copy and paste to work.

The only requirement is

1) Place it in the main picture directory where if you have multiple galleries under it

For example

/www/pictures

is there i store my galleries.

/www/pictures/gallery1
/www/pictures/gallery2
/www/pictures/gallery3

in each of the gallery, i have the images and thumbs director

/www/pictures/gallery1/images/
/www/pictures/gallery1/thumbs/

Place the buildgallery.php at /www/pictures/

and execute it. It will find all the galleries directory, and

1) Build the XML file
2) Build the index.php file

in each of the gallery...ofcourse you still need the other files in each of the gallery already, such as the SWF file.

<?
// -----------------------
// buildgallery.php 
// -----------------------
// by&#58;
// Mario - mariohm@fibertel.com.ar
// Mike Peck - www.mikecpeck.com 
// Mike Johnson - mike@solanosystems.com
// Christian Machmeier - www.redsplash.de 
// Airtight - www.airtightinteractive.com
//
// DESCRIPTION
// -----------------------
// This script automatically generates the XML document and thumbnails for SimpleViewer 
// www.airtightinteractive.com/simpleviewer/
//
// TO USE
// -----------------------
// Instructions are at&#58; www.airtightinteractive.com/simpleviewer/auto_instructions.html
//
// SET GALLERY OPTIONS HERE
// -----------------------
// Set Gallery options by editing this text&#58;
//
// -----------------------------------------------------------------------------
// START MODIFICATION BY K. NGUYEN-TU JUNE 2006
// USAGE&#58; COPY BUILDGALLERY.PHP TO GALLERY PATH
// SET PERMISSION TO 755
// POINT URL TO BUILDGALLERY.PHP TO CREATE XML FILE
// EXAMPLE&#58; HTTP&#58;//WWW.DOMAIN.COM/PICTURES/BUILDGALLERY.PHP
//------------------------------------------------------------------------------
// END OF OPTIONS
// -----------------------

// Open Current Director and obtain all sub directories
$dirfolder = opendir&#40;'./'&#41;;
while &#40;&#40;$dirfile = readdir&#40;$dirfolder&#41;&#41; !== false&#41; &#123;
  if&#40;$dirfile != "." && $dirfile != ".."&#41;&#123;
    if&#40;is_dir&#40;$dirfile&#41;&#41; &#123; 
      maincode&#40;$dirfile&#41;; // call maincode function to build xml file
      buildindex&#40;$dirfile&#41;; // call buildindex function to create index.php
    &#125;
  &#125;
&#125;
closedir&#40;$dirfolder&#41;;


// Create INDEX.PHP in each sub gallery
function buildindex&#40;$dirfile&#41;&#123;
  // Set Variable & print info
    $carreturn = "rn";
    $indexwrite = '<? $xmlpath = "./pictures/'.$dirfile.'/imageData.xml"; ?>'.$carreturn;
    $indexwrite .= '<div id="flashcontent">SimpleViewer requires Macromedia Flash. <a href="http&#58;//www.macromedia.com/go/getflashplayer/">Get Macromedia Flash.</a> If you have Flash installed, <a href="index.html?detectflash=false">click to view gallery</a></div>'.$carreturn;
    $indexwrite .= '<script type="text/javascript">'.$carreturn;
    $indexwrite .= '    var fo = new FlashObject&#40;"viewer.swf", "viewer","750", "850", "3", "#000000"&#41;;'.$carreturn;
    $indexwrite .= '    fo.addParam&#40;"scale", "noscale"&#41;;'.$carreturn;
    $indexwrite .= '    fo.addParam&#40;"quality", "best"&#41;;'.$carreturn;
    $indexwrite .= '    fo.addParam&#40;"wmode", "transparent"&#41;;'.$carreturn;
    $indexwrite .= '    fo.addParam&#40;"FlashVars", "xmlDataPath=<?=$xmlpath?>"&#41;;'.$carreturn;
    $indexwrite .= '    fo.write&#40;"flashcontent"&#41;;'.$carreturn;
    $indexwrite .= '</script>'.$carreturn;
    $indexwrite .= $carreturn.$carreturn;

    $file = "./".$dirfile."/index.php";
    if &#40;!$file_handle = fopen&#40;$file,"w"&#41;&#41; &#123; 
       print "<br>Cannot open XML document&#58; $file<br>"; 
    &#125;  elseif &#40;!fwrite&#40;$file_handle, $indexwrite&#41;&#41; &#123; 
       print "<br>Cannot write to PHP document&#58; $file<br>";   
    &#125;else&#123;
       print "<br>Successfully created PHP document&#58; $file<br>";   
    &#125;
    fclose&#40;$file_handle&#41;; 
&#125;

// Main Code Of BUILDGALLERY.PHP
function maincode&#40;$dirfile&#41; &#123;

// Read current URL Path Location Of BUILDGALLERY.PHP
$current_url = $_SERVER&#91;'HTTP_HOST'&#93;; // sample domain.com
$current_path = $_SERVER&#91;'REQUEST_URI'&#93;; // sample /pictures/gallery1/buildgallery.php
$url_string = 'http&#58;//'.$current_url.$current_path; // sample http&#58;//www.domain.com/pictures/gallery1/buildgallery.php
$url_string = str_replace &#40;'/buildgallery.php', '', $url_string&#41;; //Truncate buildgallery.php from URL

// Misc Settings&#58; Set Text Color, Frame Color, Frame Color, Border Size, Rows, Columns, etc.,
$carreturn = "rn";
$pattern = '/&#40;<&#40;?&#58;&#91;^<>&#93;+&#40;?&#58;"&#91;^"&#93;*"|'&#91;^'&#93;*'&#41;?&#41;+>&#41;/';
$textcolor = "0xFFFFFF";
$framecolor = "0xFFFFFF";
$bgcolor = "0x181818";
$framewidth = "1";
$stagepadding = "0";
$thumbnailcolumns = "11"; // How many columns for thumbnails
$thumbnailrows = "1"; // How many rows for thumbnails
$navposition = "bottom"; // Thumbnails position &#40;right, left, top, bottom&#41;
$gallery_title = ""; //Name of Gallery
$showDownloadLinks = true; // Show Download Links &#40;True, False&#41;
$linkpath = $url_string."/".$dirfile."/images/"; // sample http&#58;//www.domain.com/pictures/gallery1/images/
$thumbpath = $url_string."/".$dirfile."/thumbs/"; // sample http&#58;//www.domain.com/pictures/gallery1/thumbs/
$options .= '<SIMPLEVIEWER_DATA maxImageDimension="600" textColor="'.$textcolor.'" frameColor="'.$framecolor.'" bgColor="'.$bgcolor.'" frameWidth="'.$framewidth.'" stagePadding="'.$stagepadding.'" thumbnailColumns="'.$thumbnailcolumns.'" thumbnailRows="'.$thumbnailrows.'" navPosition="'.$navposition.'" navDirection="LTR" title="'.$gallery_title.'" imagePath="'.$linkpath.'" thumbPath="'.$thumbpath.'">';

print "Creating XML and thumbnails for SimpleViewer.<br>"; 
print "-------------------------------------------------<br><br>"; 
//Get GD imaging library info
echo $dirfile;
$tgdInfo    = getGDversion&#40;&#41;; 
if &#40;$tgdInfo == 0&#41;&#123; 
    print "Note&#58; The GD imaging library was not found on this Server. Thumbnails will not be created. Please contact your web server administrator.<br><br>";
&#125;

if &#40;$tgdInfo < 2&#41;&#123;
    print "Note&#58; The GD imaging library is version ".$tgdInfo." on this server. Thumbnails will be reduced quality. Please contact your web server administrator to upgrade GD version to 2.0.1 or later.<br><br>";
&#125;

//loop thru images 
$xml = '<?xml version="1.0" encoding="UTF-8" ?>'.$options.$carreturn;
$imagedir = "./".$dirfile."/images/";
$folder = opendir&#40;$imagedir&#41;;
while&#40;$file = readdir&#40;$folder&#41;&#41; &#123;    
    if &#40;$file&#91;0&#93; != "." && $file&#91;0&#93; != ".."&#41; &#123;
     if &#40;$file&#91;0&#93; != "Thumbs.db"&#41; &#123;
       $imagedirfile = $imagedir.$file;
       $files&#91;$file&#93; = filemtime&#40;$imagedirfile&#41;;
     &#125;
  &#125;        
&#125;    
// now sort by date modified
arsort&#40;$files&#41;;
foreach&#40;$files as $key => $value&#41; &#123;

  if &#40;$key != "Thumbs.db"&#41; &#123;
     $xml .= '<IMAGE>'.$carreturn;
     $xml .= '<NAME>'.$key.'</NAME>'.$carreturn;
     
     //Obtain EXIF Information From Pictures
     $exif_file = "./".$dirfile."/images/".$key;
     $exif = exif_read_data&#40;$exif_file, EXIF, TRUE&#41;;
    foreach &#40;$exif as $key1 => $section1&#41; &#123;
      foreach &#40;$section1 as $name1 => $val&#41; &#123;
        echo "$key1.$name1&#58; $val<br />n";
        if &#40;$name1 == "ApertureFNumber" && $key1 == "COMPUTED"&#41; &#123;
            $ApertureFNumber = "ApertureFNumber&#58; ".$val;
            
        &#125; elseif &#40;$name1 == "ExposureTime" && $key1 == "EXIF"&#41; &#123;
            list&#40;$a, $b&#41; = split &#40;"/", $val&#41;;
            $ab = $b / $a;
            $ExposureTime = "ExposureTime&#58; 1/".$ab;
        &#125; elseif &#40;$name1 == "FocalLength" && $key1 == "EXIF"&#41; &#123;
            list&#40;$a, $b&#41; = split &#40;"/", $val&#41;;
            $ab = $a / $b;
            $FocalLength = "FocalLength&#58; ".$ab."mm";
        &#125;
       
      &#125;
    &#125;


//     while&#40;list&#40;$k,$v&#41;=each&#40;$exif&#41;&#41; &#123;
//    echo "$k&#58; $v<br>n";
//   &#125;
     
     
     //add auto captions&#58; 'Image X'
     if &#40;$showDownloadLinks&#41;&#123;        
        $xml .= '<CAPTION><!&#91;CDATA&#91;<A href="'.$linkpath.''.$key.'" target="_blank" class="xmlcaption"><center><b>OPEN LARGER IMAGE&#58; '.$key.'<br>'.$ApertureFNumber.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$ExposureTime.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$FocalLength.'<br></b><center></A>&#93;&#93;></CAPTION>'.$carreturn;
     &#125;else&#123;
        $xml .= '<CAPTION></CAPTION>'.$carreturn;
     &#125;
     $xml .= '</IMAGE>'.$carreturn;
     print "- Created Image Entry for&#58; $key<br>";  
    
     if &#40;!file_exists&#40;"./".$dirfile."/thumbs/".$key&#41;&#41;&#123;                    
         if &#40;createThumb&#40;$key, $dirfile&#41;&#41;&#123;
             print "- Created Thumbnail for&#58; $key<br>";              
        &#125;
   &#125;                                    
    &#125;
&#125;






closedir&#40;$folder&#41;;

$xml .= '</SIMPLEVIEWER_DATA>';
$file = "./".$dirfile."/imageData.xml";   
if &#40;!$file_handle = fopen&#40;$file,"w"&#41;&#41; &#123; 
    print "<br>Cannot open XML document&#58; $file<br>"; 
&#125;  elseif &#40;!fwrite&#40;$file_handle, $xml&#41;&#41; &#123; 
    print "<br>Cannot write to XML document&#58; $file<br>";   
&#125;else&#123;
    print "<br>Successfully created XML document&#58; $file<br>";   
&#125;
fclose&#40;$file_handle&#41;;  
&#125;
                                                                        
// &#125;&#125;&#125;
// &#123;&#123;&#123; createThumb&#40;&#41;

/**
* Create a squared thumbnail from an existing image.
* 
* @param    string        $file        Location and name where the file is stored .
* @return    boolean
* @access    public
* @author    Christian Machmeier
*/
function createThumb&#40;$fileName, $dirfile&#41;
&#123;
    
    // Get information about the installed GD.
    $gdVersion = getGDversion&#40;&#41;;
    
    if &#40;$gdVersion == false&#41; &#123;
        return false;
    &#125;
    
    $file = "./".$dirfile.'/images/'.$fileName;
    $fileDest = "./".$dirfile.'/thumbs/'.$fileName;
    
    echo $file;
    echo $fileDest;
    
    
    // Get the image dimensions.
    $dimensions = @getimagesize&#40;$file&#41;;
    $width        = $dimensions&#91;0&#93;;
    $height        = $dimensions&#91;1&#93;;    
    
    $outputX  = 45;
    $outputY  = 45;
    $quality  = 85;
    
    // The image is of vertical shape.
    if &#40;$width < $height&#41; &#123;
        $deltaX   = 0;
        $deltaY   = &#40;$height - $width&#41; / 2;
        $portionX = $width;
        $portionY = $width;
        
    // The image is of horizontal shape.
    &#125; else if &#40;$width > $height&#41; &#123;
        $deltaX   = &#40;$width - $height&#41; / 2;
        $deltaY   = 0;
        $portionX = $height;
        $portionY = $height;
        
    // The image is of squared shape.
    &#125; else &#123;
        $deltaX   = 0;
        $deltaY   = 0;
        $portionX = $width;
        $portionY = $height;
    &#125;
    

    $imageSrc  = @imagecreatefromjpeg&#40;$file&#41;;

    // The thumbnail creation with GD1.x functions does the job.
    if &#40;$gdVersion < 2&#41; &#123;
        
        // Create an empty thumbnail image.
        $imageDest = @imagecreate&#40;$outputX, $outputY&#41;;
        
        // Try to create the thumbnail from the source image.
        if &#40;@imagecopyresized&#40;$imageDest, $imageSrc, 0, 0, $deltaX, $deltaY, $outputX, $outputY, $portionX, $portionY&#41;&#41; &#123;
            
            // save the thumbnail image into a file.
            @imagejpeg&#40;$imageDest, $fileDest, $quality&#41;;
            
            // Delete both image resources.
            @imagedestroy&#40;$imageSrc&#41;;
            @imagedestroy&#40;$imageDest&#41;;
            
            return true;
            
        &#125;
        
    &#125; else &#123;    
        // The recommended approach is the usage of the GD2.x functions.
        
        // Create an empty thumbnail image.
        $imageDest = @imagecreatetruecolor&#40;$outputX, $outputY&#41;;
        
        // Try to create the thumbnail from the source image.
        if &#40;@imagecopyresampled&#40;$imageDest, $imageSrc, 0, 0, $deltaX, $deltaY, $outputX, $outputY, $portionX, $portionY&#41;&#41; &#123;
            
            // save the thumbnail image into a file.
            @imagejpeg&#40;$imageDest, $fileDest, $quality&#41;;
            
            // Delete both image resources.
            @imagedestroy&#40;$imageSrc&#41;;
            @imagedestroy&#40;$imageDest&#41;;
            
            return true;            
        &#125;        
    &#125;
    
    return false;
&#125;
        
function getGDversion&#40;&#41; &#123;
   static $gd_version_number = null;
   if &#40;$gd_version_number === null&#41; &#123;
       // Use output buffering to get results from phpinfo&#40;&#41;
       // without disturbing the page we're in.  Output
       // buffering is "stackable" so we don't even have to
       // worry about previous or encompassing buffering.
       ob_start&#40;&#41;;
       phpinfo&#40;8&#41;;
       $module_info = ob_get_contents&#40;&#41;;
       ob_end_clean&#40;&#41;;
       if &#40;preg_match&#40;"/bgds+versionb&#91;^dnr&#93;+?&#40;&#91;d.&#93;+&#41;/i",
               $module_info,$matches&#41;&#41; &#123;
           $gd_version_number = $matches&#91;1&#93;;
       &#125; else &#123;
           $gd_version_number = 0;
       &#125;
   &#125;
   return $gd_version_number;
&#125;
 
return;
[url]http://www.photographybykevin.net[/url]

Simple Viewer FAQ By Kevin
[url]http://knguyentu.com/wordpress/photography-by-kevin/simpleviewer-flash-photo-gallery/[/url]

Re: Add EXIF Data To Photo

Hi!
This is really greaat and exactly what I need!
trying to get it to work and after fixed about 3-4 problems I don´t get the last one to work tongue
This one says:
Fatal error: Call to undefined function: exif_read_data() in /customers/******.com/******.com/httpd.www/simpleviewer/buildgallery.php on line 114

means, it don't know what exif is??

can anyone see the problem?


    //add auto captions&#58; 'Image X'
    if &#40;$showDownloadLinks&#41;&#123;      
      $xml .= '<CAPTION><!&#91;CDATA&#91;<A href="'.$linkpath.''.$key.'" target="_blank" class="xmlcaption"><center><b>OPEN LARGER IMAGE&#58; '.$key.'<br>'.$ApertureFNumber.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$ExposureTime.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$FocalLength.'<br></b><center></A>&#93;&#93;></CAPTION>'.$carreturn;
    &#125;else&#123;
      $xml .= '<CAPTION></CAPTION>'.$carreturn;
    &#125; 
    $xml .= '</image>';
    
    print "- Created Image Entry for&#58; $key<br>";  
    
    if &#40;!file_exists&#40;"./thumbs/".$key&#41;&#41;&#123;                    
        if &#40;createThumb&#40;$key&#41;&#41;&#123;
            print "- Created Thumbnail for&#58; $key<br>";              
        &#125;                                    
    &#125;
&#125;

//Obtain EXIF Information From Pictures
$exif_file = "./".$dirfile."images".$key;
$exif = exif_read_data&#40;$exif_file, EXIF, TRUE&#41;;             <-- THIS IS LINE 114!
foreach &#40;$exif as $key1 => $section1&#41; &#123;
  foreach &#40;$section1 as $name1 => $val&#41; &#123;
    echo "$key1.$name1&#58; $val<br />n";
    if &#40;$name1 == "ApertureFNumber" && $key1 == "COMPUTED"&#41; &#123;
        $ApertureFNumber = "ApertureFNumber&#58; ".$val;
           
    &#125; elseif &#40;$name1 == "ExposureTime" && $key1 == "EXIF"&#41; &#123;
        list&#40;$a, $b&#41; = split &#40;"/", $val&#41;;
        $ab = $b / $a;
        $ExposureTime = "ExposureTime&#58; 1/".$ab;
    &#125; elseif &#40;$name1 == "FocalLength" && $key1 == "EXIF"&#41; &#123;
        list&#40;$a, $b&#41; = split &#40;"/", $val&#41;;
        $ab = $a / $b;
        $FocalLength = "FocalLength&#58; ".$ab."mm";
    &#125;
       
  &#125;
&#125;