image_type_to_mime_type

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

image_type_to_mime_type取得 getimagesize,exif_read_data,exif_thumbnail,exif_imagetype 所返回的图像类型的 MIME 类型

说明

image_type_to_mime_type ( int $imagetype ) : string

image_type_to_mime_type() 函数可以判断一个 IMAGETYPE 常量的 MIME 类型。

Example #1 image_type_to_mime_type (file)

<?php
header
("Content-type: " image_type_to_mime_type(IMAGETYPE_PNG));
?>

返回值如下:

返回值常量
图像类型(imagetype 返回值
IMAGETYPE_GIF image/gif
IMAGETYPE_JPEG image/jpeg
IMAGETYPE_PNG image/png
IMAGETYPE_SWF application/x-shockwave-flash
IMAGETYPE_PSD image/psd
IMAGETYPE_BMP image/bmp
IMAGETYPE_TIFF_II (intel byte order) image/tiff
IMAGETYPE_TIFF_MM (motorola byte order) image/tiff
IMAGETYPE_JPC application/octet-stream
IMAGETYPE_JP2 image/jp2
IMAGETYPE_JPX application/octet-stream
IMAGETYPE_JB2 application/octet-stream
IMAGETYPE_SWC application/x-shockwave-flash
IMAGETYPE_IFF image/iff
IMAGETYPE_WBMP image/vnd.wap.wbmp
IMAGETYPE_XBM image/xbm

Note: 本函数不需要 GD 库。

参见 getimagesize()exif_imagetype()exif_read_data()exif_thumbnail()

相关文章
php exif 函数 取得嵌入在 tiff 或 jpeg 图像中的缩略图php gd 和图像处理 函数 取得当前安装的 gd 库的信息php gd 和图像处理 函数 取得图像大小php gd 和图像处理 函数 取得图像类型的文件后缀php gd 和图像处理 函数 取得 getimagesize,exif read data,exif thumbnail,exif imagetype 所返回的图像类型的 mime 类型php gd 和图像处理 函数 返回经过仿射变换后的图像,剪切区域可选php gd 和图像处理 函数 设定图像的混色模式php gd 和图像处理 函数 使一个图像中调色板版本的颜色与真彩色版本更能匹配php gd 和图像处理 函数 取得指定颜色的索引值或有可能得到的最接近的替代值php gd 和图像处理 函数 取得指定颜色 + alpha 的索引值或有可能得到的最接近的替代值php gd 和图像处理 函数 取得某索引的颜色php gd 和图像处理 函数 取得一幅图像的调色板中颜色的数目php gd 和图像处理 函数 从 gd2 文件或 url 新建一图像php gd 和图像处理 函数 从给定的 gd2 文件或 url 中的部分新建一图像php gd 和图像处理 函数 从字符串中的图像流新建一图像php gd 和图像处理 函数 检查图像是否为真彩色图像php gd 和图像处理 函数 用 postscript type1 字体把文本字符串画在图像上php gd 和图像处理 函数 取得图像宽度php gd 和图像处理 函数 取得图像高度php gd 和图像处理 函数 返回当前 php 版本所支持的图像类型
关注编程学问公众号