Jump to content

PNG header information


fritz.fx

Recommended Posts

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

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";
    }
}
?>

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.