WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World
Retrieve the embedded thumbnail of a TIFF or JPEG image

exif_thumbnail

(PHP 4 >= 4.2.0, PHP 5)

exif_thumbnailRetrieve the embedded thumbnail of a TIFF or JPEG image

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 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

filename

The name of the image file being read. This image contains an embedded thumbnail.

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.

Return Values

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

Changelog

Version Description
4.3.0 The optional parameters width , height , and imagetype all became available.
4.3.0 May return thumbnails in the TIFF format.

Examples

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

See Also


Create a Thumbnail Using PHP, GD and Exif
Categories : PHP, Graphics, Exif, GD image library
PHP Thumbnail script - Generate thumbnails on the fly.
Categories : PHP, Graphics, GD image library
Create Thumbnails - resize an image - jpeg, jpg, gif, png to the specifed width and height in proportion without loosing out on pixcel quality.
Categories : PHP, GD image library, Graphics



Creating thumbnails from MySQL Blobs online
Categories : PHP, MySQL, Graphics, HTML and PHP, Databases
EasyPhpThumbnail Class - The EasyPhpThumbnail class allows you to generate thumbnails and handle image manipulation for GIF, JPG and PNG on-the-fly.
Categories : PHP, PHP Classes, Object Oriented, Graphics, GD image library
Quick PHP GD JPG Thumbnailer Script
Categories : PHP, GD image library, Graphics
Thumbnail in image proportion on the fly
Categories : PHP, Graphics, GD image library
This is a script that list all image files on a given directory, and displays the thumbnails nicely formated within an HTML table. It also make use of JavScript to open pop up windows when the users want to see the full photo.
Categories : Graphics, PHP, Complete Programs, Java Script
Dynamic thumbnails using the GD image library
Categories : PHP, GD image library, Graphics