Hello,

I'm using exif_read_data() for the first time and without any luck! I'm trying to use the following script but I just keep on getting "Call to undefined function: exif_read_data()":

$image_loc = '/home/cberry/public_html/test1/images/event_images/123.jpg'

$exif = exif_read_data($image_loc, 'ANY_TAG', 1, true);
	echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n";
	$exif = exif_read_data($image_loc, 'ANY_TAG', 1, true);
	foreach ($exif as $key => $section) {
    foreach ($section as $name => $val) {
       echo "$key.$name: $val<br />\n";
  			 }
		}
	echo '<pre><br />';
	print_r($exif);

If I understand this correctly the 1st parameter, $image_loc, needs to point to the image file you want to extract the EXIF data from. The second parameter, 'ANY_TAG', determins what data you're looking for. The third parameter determins if the data should go into an array... I think but I'm fuzzy on this one. And the 4th parameter determins if the thumbnail is read.

I'd really appreciate some help trying to understand this!

Many thanks!

Chris

    In Windows, you need to edit php.ini, in the windows directory. Last time I did it, these were the changes I needed:

    extension_dir=extensions/
    extension=php_exif.dll

    Maybe this one too:
    extension=php_gd2.dll

      Thanks!

      It's definetly my php.ini file. I just tried the script on localhost and it worked 1st time! I guess I'll have to talk to my host as I don't have access to the php.ini file on my live server.

      Chris

        Write a Reply...