[ansel] Patch (and new file) to output EXIF data on image view

Heath S. Hendrickson heath at outerspaceconsultants.com
Mon Jan 19 09:49:13 PST 2004


Here's a patch and new file to output the image EXIF data beneath the 
image when viewing the screen resolution image.

Would you be willing to accept a patch for user configurable EXIF 
fields?  If not, I won't bother, otherwise I'll see what I can come up 
with.  Is there an automatic way when parsing preferences to allow for a 
delimited free-form text field? 

heath

------ new file ----------
[root at space view]# cat exif-image.inc
<div align="center">
<table border="0" cellpadding="2" cellspacing="0" class="whitebox" 
style="padding:10px;">
<tr>
   <td>[&nbsp;
<?php

require_once ANSEL_BASE . '/lib/Exif.php';
$imageFile = $image->toFile();
$result = read_exif_data_raw($imageFile);

$output = '';

if (empty($result['ValidEXIFData'])) {
    $output .= 'No embedded information found.';
} else {
    $IDF0 = array('Make', 'Model', 'Orientation', 'xResolution', 
'yResolution', 'ResolutionUnit', 'Software', 'DateTime', 
'YCbCrPositioning');
    $SubIDF = array('ExposureTime', 'FNumber', 'ExifVersion', 
'DateTimeOriginal', 'DateTimedigitized', 'ComponentsConfiguration', 
'ComponentsConfiguration', 'CompressedBitsPerPixel', 
'ShutterSpeedValue', 'ApertureValue', 'MeteringMode', 'Flash', 
'FocalLength', 'UserComment', 'ColorSpace', 'ExifImageWidth', 
'ExifImageHeight', 'SensingMethod', 'FileSource');

        foreach ($result['IFD0'] as $key => $value) {
                if (in_array($key, $IDF0) && trim($value) != '') {
            $output .= "<b>$key</b>:&nbsp;$value&nbsp;|&nbsp;";
        }
        }

        foreach ($result['SubIFD'] as $key => $value) {
                if (in_array($key, $SubIDF) && trim($value) != '') {
            $output .= "<b>$key</b>:&nbsp;$value&nbsp;|&nbsp;";
        }
        }
}

echo $output;
?>
&nbsp;]
  </td>
</tr>
</table>
</div>
------------ end new file -------------


---------- patch -------------------
[root at space ansel]# cvs diff view.php
Index: view.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/view.php,v
retrieving revision 1.36
diff -r1.36 view.php
94a95
 >         require ANSEL_TEMPLATES . '/view/exif-image.inc';
--------- end patch ------------------




More information about the ansel mailing list