I'm building a website that uses PHP to select all of the images from a folder to be displayed in a gallery. I also want the image alt
tag to be the FileName of the photo's EXIF data - So I've developped this script:
<?php
$folder = 'cms/galleries/gallery-1/';
$filetype = '*.*';
$files = glob($folder.$filetype);
foreach ($files as $file)
{
$filedata = exif_read_data($file[$i]);
if(is_array($filedata) && isset($filedata['FileName'])){
$filename = $filedata['FileName'];
} else{
$filename = explode('.', basename($file[$i]));
$filename = $filename[0];
}
echo '<div class="photoHolder"><div class="photoCell"><a class="fancybox" rel="group" href="'.$file.'"><img class="photo" src="'.$file.'" alt="'.$filename.'"></a></div></div>';
}
?>
The problem is I'm getting this error:
Fatal error: Call to undefined function exif_read_data() in C:\AppServ\www\
I have no idea what this means so can anyone help me with this or ruggest a few minor edits to get this up and running?
May be EXIF extension is not enabled. First enable it from php.ini file.