PHP image_type_to_mime_type function
Like this blog? Consider exploring one of our sponsored banner ads...
image_type_to_mime_type
(PHP 4 >= 4.3.0, PHP 5)
image_type_to_mime_type — Get Mime-Type for image-type returned by getimagesize,exif_read_data, exif_thumbnail, exif_imagetypeDescriptionstring image_type_to_mime_type ( int imagetype )
The image_type_to_mime_type() function will determine
the Mime-Type for an IMAGETYPE constant.
imagetype
One of the IMAGETYPE_XXX constants
Return Values
The returned values are as follows
Table 1. Returned values Constants
imagetypeReturned valueIMAGETYPE_GIFimage/gifIMAGETYPE_JPEGimage/jpegIMAGETYPE_PNGimage/pngIMAGETYPE_SWFapplication/x-shockwave-flashIMAGETYPE_PSDimage/psdIMAGETYPE_BMPimage/bmpIMAGETYPE_TIFF_II (intel byte order)image/tiff IMAGETYPE_TIFF_MM (motorola byte order)image/tiffIMAGETYPE_JPCapplication/octet-streamIMAGETYPE_JP2image/jp2IMAGETYPE_JPXapplication/octet-streamIMAGETYPE_JB2application/octet-streamIMAGETYPE_SWCapplication/x-shockwave-flashIMAGETYPE_IFFimage/iffIMAGETYPE_WBMPimage/vnd.wap.wbmpIMAGETYPE_XBMimage/xbm
Examples
Example 1. image_type_to_mime_type (file)
header("Content-type: " . image_type_to_mime_type(IMAGETYPE_PNG));
Notes
Note:
This function does not require the GD image library.
getimagesize()exif_imagetype()exif_read_data()exif_thumbnail()
About this entry
You’re currently reading “PHP image_type_to_mime_type function,” an entry on BRADINO
- Published:
- 2.26.07 / 1am
- Category:
- PHP Functions
- Tags:
No comments
Jump to comment form | comments rss [?] | trackback uri [?]