exif_thumbnail

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

exif_thumbnailRetrieve the embedded thumbnail of an image

Descrierea

exif_thumbnail ( mixed $stream [, int &$width [, int &$height [, int &$imagetype ]]] ) : string

exif_thumbnail() reads the embedded thumbnail of an image.

If you want to deliver thumbnails through this function, you should send the mimetype information using the header() function.

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.

Parametri

stream

The location of the image file. This can either be a path to the file or a stream resource.

width

The return width of the returned thumbnail.

height

The returned height of the returned thumbnail.

imagetype

The returned image type of the returned thumbnail. This is either TIFF or JPEG.

Valorile întoarse

Returns the embedded thumbnail, or FALSE if the image contains no thumbnail.

Exemple

Example #1 exif_thumbnail() example

<?php
$image 
exif_thumbnail('/path/to/image.jpg'$width$height$type);

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

Istoricul schimbărilor

Versiune Descriere
7.2.0 The filename parameter was renamed to stream and now supports both local files or stream resources.

Note

Notă:

If the stream is used to pass a stream to this function, then the stream must be seekable. Note that the file pointer position is not changed after this function returns.

A se vedea și