image_type_to_mime_type
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
image_type_to_mime_type — 取得 getimagesize,exif_read_data,exif_thumbnail,exif_imagetype 所返回的影象型別的 MIME 型別
說明
    image_type_to_mime_type(int 
   $imagetype): stringimage_type_to_mime_type() 函式可以判斷一個 IMAGETYPE 常量的 MIME 型別。
示例 #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 | 
注意: 本函式不需要 GD 庫。
參見 getimagesize(),exif_imagetype(),exif_read_data() 和 exif_thumbnail()。