Now however I have a new problem. I want to display the thumbnail of the image and the EXIF data on one page. PHP doesn't like it.
I can EITHER show the thumbnail when it executes the header statement
header('Content-type: ' .image_type_to_mime_type($type));
but then it does not show any EXIF data
OR show the EXIF data by commenting out the header staement
but then it shows the thumbnail as a series of weird characters, like
1AQaq"2‘¡±B#ÁRÑð3$bár‚’CS
etc etc.
Any feedback appreciated!
thanks,
Matt
<?php
define('MYFILE', 'Avatars\Image17IR.jpg') ;
$width = 0;
$height = 0 ;
$type = '' ;
$imgdat = exif_thumbnail(MYFILE, $width, $height, $type);
if ($imgdat!==false) {
// when the 2 lines below are executed, the thumbnail is shown, but nothing further
// when the 2 lines below are commented out, the exif data is shown, but the thumbnail is output as garbage
header('Content-type: ' .image_type_to_mime_type($type));
echo $imgdat;
$exif = exif_read_data(MYFILE, 0, true);
print "<table border=\"1\"><tr><td>Key</td><td>Name</td><td>Value</td></tr><tr>" ;
foreach ($exif as $key => $section) {
foreach ($section as $name => $val) {
print "<td>" . $key . "</td>" ;
print "<td>" . $name . "</td>" ;
print "<td>" . $val . "</td>" ;
print "</tr>" ;
}
}
print "</table>" ;
// shows garbage, not the image
echo $imgdat ;
}
?>