fritz.fx Posted July 29, 2008 Share Posted July 29, 2008 Is there any way to read the header info from a .PNG file similar to the way exif_read_data gets the info from TIFF & JPEG files?? I get this error Warning: exif_read_data(pb025900.tiff) [function.exif-read-data]: File not supported in C:\xampp\htdocs\take5\svsstest\pbucon\png.php on line 5 pb025900.png: When using this code $exif = exif_read_data('pb025900.png', 0, true); echo "pb025900.png:<br />\n"; foreach ($exif as $key => $section) { foreach ($section as $name => $val) { echo "$key.$name: $val<br />\n"; } } Quote Link to comment Share on other sites More sharing options...
zenag Posted July 29, 2008 Share Posted July 29, 2008 make sure that u have .png file in ur folder.... Quote Link to comment Share on other sites More sharing options...
fritz.fx Posted July 29, 2008 Author Share Posted July 29, 2008 yes, both the image and the script are in the same directory Quote Link to comment Share on other sites More sharing options...
zenag Posted July 29, 2008 Share Posted July 29, 2008 upload another .png file and try this code <?php echo "header.png:<br />\n"; $exif = exif_read_data('header.png', 'IFD0'); echo $exif===false ? "No header data found.<br />\n" : "Image contains headers<br />\n"; $exif = exif_read_data('header.png', 0, true); echo "test2.jpg:<br />\n"; foreach ($exif as $key => $section) { foreach ($section as $name => $val) { echo "$key.$name: $val<br />\n"; } } ?> Quote Link to comment Share on other sites More sharing options...
fritz.fx Posted July 29, 2008 Author Share Posted July 29, 2008 already tried that one, works fine on tiffs and jpg's but not png's Quote Link to comment Share on other sites More sharing options...
corbin Posted July 29, 2008 Share Posted July 29, 2008 http://php.net/exif_read_data "exif_read_data() reads the EXIF headers from a JPEG or TIFF image file" So, does anyone think this is gonna work with PNG, or am I alone here? Anyway, considering EXIF is not supported by PNG, good luck with this ;p. If I may ask, what kind of data are you wanting to pull from the PNG? Quote Link to comment 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.