foucquet Posted October 24, 2011 Share Posted October 24, 2011 OK, so I am trying to read exif data from images and have come up against a snag that I cannot see the answer to. I know that what I have at present is pretty basic, but I want to be sure that I know how to access the bits I want before tidying it up into something more sophisticated. The coide I have is this:- $exif = exif_read_data('brass jaw.jpg', 'EXIF'); $name = $exif['FileName']; $height = $exif['ExifImageWidth']; $width = $exif['ExifImageLength']; $model = $exif['Model']; $exposuretime = $exif['ExposureTime']; $fnumber = $exif['FNumber']; $iso = $exif['ISOSpeedRatings']; $date = $exif['DateTime']; echo "File Name: $name<br />"; echo "Height: $height<br />"; echo "Width: $width<br />"; echo "Camera: $model<br />"; echo "Shutter Speed: $exposuretime<br />"; echo "F number: $fnumber<br />"; echo "ISO: $iso<br />"; echo "Date & Time: $date<br />"; var_dump($exif); This code produces the following:- File Name: brass jaw.jpg Height: 640 Width: 360 Camera: Canon EOS 550D Shutter Speed: 244/1000000 F number: 8000000/1000000 ISO: Array Date & Time: 2011:09:17 13:52:30 Which serves quite well apart from the ISO, which comes back as "Array". Now when I do a var_dump I see that ISOSpeedRatings returns as this:- 'ISOSpeedRatings' => array 0 => int 800 1 => int 800 What I can't work out is how to access the information from this - I know that the solution will probably be very simple, and that I will end up kicking myself, but I could use a little help. Quote Link to comment https://forums.phpfreaks.com/topic/249690-problem-reading-exif-data/ Share on other sites More sharing options...
trq Posted October 24, 2011 Share Posted October 24, 2011 It's a simple multidimensional array. echo $iso['ISOSpeedRatings'][0]; echo $iso['ISOSpeedRatings'][1]; Quote Link to comment https://forums.phpfreaks.com/topic/249690-problem-reading-exif-data/#findComment-1281719 Share on other sites More sharing options...
foucquet Posted October 24, 2011 Author Share Posted October 24, 2011 It's a simple multidimensional array. echo $iso['ISOSpeedRatings'][0]; echo $iso['ISOSpeedRatings'][1]; That produces "Notice: Undefined index: ISOSpeedRatings" - I had thought of this but got the same result and couldn't work out why, which is why I resorted to the forum... Quote Link to comment https://forums.phpfreaks.com/topic/249690-problem-reading-exif-data/#findComment-1281724 Share on other sites More sharing options...
foucquet Posted October 24, 2011 Author Share Posted October 24, 2011 It's a simple multidimensional array. echo $iso['ISOSpeedRatings'][0]; echo $iso['ISOSpeedRatings'][1]; That produces "Notice: Undefined index: ISOSpeedRatings" - I had thought of this but got the same result and couldn't work out why, which is why I resorted to the forum... OK, problem solved replacing $iso with $exif did the trick - logical really, I just knew the solution would be simple... Quote Link to comment https://forums.phpfreaks.com/topic/249690-problem-reading-exif-data/#findComment-1281728 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.