Description
string
exif_thumbnail ( string filename [, int &width [, int &height [, int &imagetype]]])
exif_thumbnail() reads the embedded thumbnail of
a TIFF or JPEG image_ If the image contains no thumbnail FALSE
will be returned_
The parameters width,
height and imagetype are
available since PHP 4_3_0 and return the size of the thumbnail as well
as its type_ It is possible that exif_thumbnail()
cannot create an image but can determine its size_ In this case, the
return value is FALSE but width and
height are set_
If you want to deliver thumbnails through this function, you should send
the mimetype information using the header() function_
The following example demonstrates this:
Ejemplo 1_ exif_thumbnail() example <?php
if (array_key_exists('file',$_REQUEST)) {
$image = exif_thumbnail($_REQUEST['file'], $width, $height, $type);
} else {
$image = false;
}
if ($image!==false) {
header("Content_type: "_image_type_to_mime_type($type));
echo $image;
exit;
} else {
// no thumbnail available, handle the error here
echo "No thumbnail available";
}
?> |
|
Starting from version PHP 4_3_0, the function
exif_thumbnail() can return thumbnails in
TIFF format_
Nota:
This function is only available in PHP 4 compiled using
__enable_exif_
Its functionality and behaviour has changed in PHP 4_2_0
Nota:
This function does not require the GD image library_
See also exif_read_data() and
image_type_to_mime_type()_