1.44 build 177
Please rate DAlbum at HotScripts.com
Please rate DAlbum at @ PHP-Resource.de
Rate DAlbum @ The PHP Resource Index
Script Rating:
Display EXIF info line   

The purpose of this sample is add a line with EXIF parameters (time, ISO, exposition time etc.) to the image page that will be displayed when "Show Details" mode is off.

Please check demo for an example.

Instructions

1. Edit your t_showimg.php page template and insert the following code in position where you want EXIF info to be diplayed.

  <div style="font-size:8pt;white-space:nowrap;text-align:center;">
    <?    include(DALBUM_ROOT "/config/exifline.php"); ?>
</div>

For example, to add it right below the image, insert it after image closing tag:

  <td >
    <a href="<?php template('ImageHref');?>">
    <img id="Image"
         src="<?php template('ImageSrc');?>"
         title="<?php template('ImageAlt');?>"
         <?php template('ImageWidthHeight'); ?>
         alt="">
    </a>

  <div style="font-size:8pt;white-space:nowrap;text-align:center;">
    <?    include(DALBUM_ROOT "/config/exifline.php"); ?>
</div>

  </td>

2. Create a file called exifline.php in ./config directory containing the following script (you can download the script from exifline.zip):

  <?php
//
// This module reads and prints exif details from current image
// if image details bar is not displayed (by Show Details button).
//
// Feel free to add, remove and rearrange parameters.
//
if ($image->IsImage() && // This will protect against direct include
    
!($bShowDetails && $g_bShowEXIFDetailsButton))
{
    
// Read EXIF
    
if ($g_bForceDAlbumEXIFCode || !extension_loaded('exif'))
    {
        require_once(
DALBUM_ROOT  "/include/exif.php");
        
$exif=@exif_php_read_data(absfname($image->m_sFullFilename));
    }
    else
    {
        
$exif=@exif_read_data(absfname($image->m_sFullFilename));
    }

    if (
$exif===false)
        
$exif=array();

    
$data=array();

    
// Resolution
    
if ($image->m_nX>&& $image->m_nY>0)
        
$data[]="|({$image->m_nX}x{$image->m_nY})";

    
// Date/time
    
$date="";
    if (isset(
$exif['DateTimeOriginal']))
        
$date=$exif['DateTimeOriginal'];
    if (empty(
$date) && isset($exif['DateTime']))
        
$date=$exif['DateTime'];

    if (!empty(
$date))
    {
        
$date=split(':',str_replace(' ',':',$date));
        
$date="{$date[0]}-{$date[1]}-{$date[2]} {$date[3]}:{$date[4]}:{$date[5]}";
        
$date=strftime($lang['cExiflineDateFormat'],strtotime($date));
        
$data[]="|$date";
    }

    
// ISO speed
    
$iso="";

    if (isset(
$exif['ISOSpeedRatings']))
        
$iso=$exif['ISOSpeedRatings'];
    else if (isset(
$exif['MakerNote']) && isset($exif['ModeArray']))
    {
        
// Add ISO for PowerShot cameras
        
switch (@$exif['ModeArray'][16])
        {
            case 
15$iso="auto";break;
            case 
16$iso="50";break;
            case 
17$iso="100";break;
            case 
18$iso="200";break;
            case 
19$iso="400";break;
        }
    }

    if (!empty(
$iso))
        
$data[]="{$lang['showExifISO']}|$iso";


    
// Exposure
    
if (isset($exif['ExposureTime']))
    {
        list(
$d1,$d2)=split('/',$exif['ExposureTime']);
        if (
$d1>&& $d2>0)
            
$e=$d1/$d2;
        else
            
$e=$exif['ExposureTime'];
        if (
$e<&& $e>0)
            
$e="1/" round(1/$e,0) . " s";
        else
            
$e=round($e,1) ." s";

        
$data[]=$lang['cExiflineExposure']."|".$e;
    }

    
// Aperture
    
if (isset($exif['COMPUTED']['ApertureFNumber']))
        
$data[]="{$lang['cExiflineAperture']}|{$exif['COMPUTED']['ApertureFNumber']}";

    
// Flash
    
if (isset($exif['Flash']))
    {
        
$e=$lang[($exif['Flash']&1)?'showExifFlashYes':'showExifFlashNo'];
        
$data[]="{$lang['cExiflineFlash']}|$e";
    }

    
// Combine all together into one line
    
$sExifDetails="";
    if (!empty(
$data))
    {
        foreach (
$data as $d)
        {
            list(
$name,$value)=split('\|',$d);
            if (!empty(
$sExifDetails))
                
$sExifDetails.="; ";
            
$sExifDetails.="$name$value";
        }
    }

    
// print the line
    
print $sExifDetails;
}
?>

3. Enjoy!