EXIF_THUMBNAIL(3) 1 EXIF_THUMBNAIL(3)
exif_thumbnail - Retrieve the embedded thumbnail of a TIFF or JPEG image
SYNOPSIS
string exif_thumbnail (string $filename, [int &$width], [int &$height], [int &$imagetype])
DESCRIPTION
exif_thumbnail(3) reads the embedded thumbnail of a TIFF or JPEG image.
If you want to deliver thumbnails through this function, you should send the mimetype information using the header(3) function.
It is possible that exif_thumbnail(3) cannot create an image but can determine its size. In this case, the return value is FALSE but
$width and $height are set.
PARAMETERS
o $filename
- The name of the image file being read. This image contains an embedded thumbnail.
o $width
- The return width of the returned thumbnail.
o $height
- The returned height of the returned thumbnail.
o $imagetype
- The returned image type of the returned thumbnail. This is either TIFF or JPEG.
RETURN VALUES
Returns the embedded thumbnail, or FALSE if the image contains no thumbnail.
EXAMPLES
Example #1
exif_thumbnail(3) 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';
}
?>
SEE ALSO
exif_read_data(3), image_type_to_mime_type(3).
PHP Documentation Group EXIF_THUMBNAIL(3)