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"; } } Link to comment https://forums.phpfreaks.com/topic/117108-png-header-information/ 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.... Link to comment https://forums.phpfreaks.com/topic/117108-png-header-information/#findComment-602350 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 Link to comment https://forums.phpfreaks.com/topic/117108-png-header-information/#findComment-602357 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"; } } ?> Link to comment https://forums.phpfreaks.com/topic/117108-png-header-information/#findComment-602358 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 Link to comment https://forums.phpfreaks.com/topic/117108-png-header-information/#findComment-602398 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? Link to comment https://forums.phpfreaks.com/topic/117108-png-header-information/#findComment-602406 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.