note 49017 added to function.exif-thumbnail
| From: | hanspeter dot debets at dendrite dot com | Date: | Fri, 14 Jan 2005 14:35:31 +0000 |
| Subject: | note 49017 added to function.exif-thumbnail | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83261@lists.php.net to get a copy of this message | ||
Great that the thumbnail can be in TIFF format (f.i. Kodak cameras have embedded thumbnail in TIFF)
BUT I have not been able to show TIFF as an embedded image in HTML (using the <IMG...> tag).
There seems to be no function in PHP to change TIFF to, lets say, JPG. (imagecreatefromstring gives
a 'unknown datatype' error for the TIFF stream. So below sample works great for JPEG
embedded thumbnail, but not for TIFF embedded (but then, maybe I did something wrong?):
test_exif.php:
<HTML>
<HEAD>
<TITLE>Test EXIF Read </TITLE>
</HEAD>
<BODY>
<?php
$image='P0000614.JPG';
echo("<B>". $image. "</B>:<BR><BR>\n");
$exif = exif_read_data($image, 'ANY_TAG',true);
if (!$exif===false)
{
echo("Image contains headers<br><br>");
echo("<A href=showthumb.php?image=" . $image ."> <IMG border=0
src=showthumb.php?image=" . $image ."></A><BR><BR>");
foreach ($exif as $key => $section)
{
foreach ($section as $name => $val)
{
echo "$key.$name: $val<br>\n";
}
}
}
else
{
echo("Sorry, image <B>".$image . "</B> does not contain (readable)
EXIF data.");
}
?>
</BODY>
</HTML>
showthumb.php:
<?php
$imgdat = exif_thumbnail($_REQUEST['image'],$width, $height, $type);
header('Content-type: ' . image_type_to_mime_type($type));
echo($imgdat);
?>
When clicking on the <A> opens the TIFF image in the program that windows assigned to this
type, but the JPEG opens in the browser.
I am using PHP 4.3.6 on windows iis 4 (yeah, I know.....)
----
Manual Page -- http://www.php.net/manual/en/function.exif-thumbnail.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49017
Delete -- http://master.php.net/manage/user-notes.php?action=delete+49017&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49017&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+49017&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+49017&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+49017&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+49017&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49017&report=yes
Search -- http://master.php.net/manage/user-notes.php