exif_thumbnail 取得嵌入在 TIFF 或 JPEG 图像中的缩略图 php函数


exif_thumbnail

(PHP 4 >= 4.2.0, PHP 5)

exif_thumbnail取得嵌入在 TIFF 或 JPEG 图像中的缩略图

说明

string exif_thumbnail ( string $filename [, int &$width [, int &$height [, int &$imagetype ]]] )

exif_thumbnail() 读取 TIFFJPEG 图像中的嵌入缩略图。如果图像不包含缩略图则返回 FALSE

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.

参数

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.

返回值

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

更新日志

版本 说明
4.3.0 The optional parameters width, height, and imagetype all became available.
4.3.0 May return thumbnails in the TIFF format.

范例

Example #1 exif_thumbnail() 例子

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

参见

  • exif_read_data() - 从 JPEG 或 TIFF 文件中读取 EXIF 头信息
  • image_type_to_mime_type() - 取得 getimagesize,exif_read_data,exif_thumbnail,exif_imagetype 所返回的图像类型的 MIME 类型



相关阅读:
exit Output a message and terminate the current script
exp 计算 e 的指数
explode 使用一个字符串分割另一个字符串
expm1 返回 exp(number)1,甚至当 number 的值接近零也能计算出准确结果
extension_loaded Find out whether an extension is loaded
extract 从数组中将变量导入到当前的符号表
ezmlm_hash 计算 EZMLM 所需的散列值
fbsql_affected_rows Get number of affected rows in previous FrontBase operation
fbsql_autocommit Enable or disable autocommit
fbsql_blob_size Get the size of a BLOB
fbsql_change_user Change logged in user of the active connection
fbsql_clob_size Get the size of a CLOB
fbsql_close Close FrontBase connection
fbsql_commit Commits a transaction to the database
快速导航

Copyright © 2016 phpStudy | 皖ICP备18014864号-4