exif_thumbnail

PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8
exif_thumbnail - Retrieve the embedded thumbnail of an image
Manual
Code Examples

exif_thumbnail(
     resource|string$file,
     [intwidth = null],
     [intheight = null],
     [intimage_type = null]
): string|false

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.

Parameters

file

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.

image_type

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.

Notes

Note:

If the file 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.

Changelog

Version Description
7.2.0 The file parameter now supports both local files and stream resources.

Related Functions

Example of exif_thumbnail

Show all examples for exif_thumbnail

PHP Version:


Function exif_thumbnail:

Exchangeable image information Functions

Most used PHP functions