<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.image-type-to-extension.html">image_type_to_extension</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.image2wbmp.html">image2wbmp</a></div> <div class="up"><a href="ref.image.html">GD and Image Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.image-type-to-mime-type" class="refentry"> <div class="refnamediv"> <h1 class="refname">image_type_to_mime_type</h1> <p class="verinfo">(PHP 4 >= 4.3.0, PHP 5)</p><p class="refpurpose"><span class="refname">image_type_to_mime_type</span> — <span class="dc-title">Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype</span></p> </div> <div class="refsect1 description" id="refsect1-function.image-type-to-mime-type-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>image_type_to_mime_type</strong></span> ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$imagetype</code></span> )</div> <p class="para rdfs-comment"> The <span class="function"><strong>image_type_to_mime_type()</strong></span> function will determine the Mime-Type for an IMAGETYPE constant. </p> </div> <div class="refsect1 parameters" id="refsect1-function.image-type-to-mime-type-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">imagetype</code></em></span> <dd> <p class="para"> One of the <em>IMAGETYPE_XXX</em> constants. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.image-type-to-mime-type-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> The returned values are as follows <table class="doctable table"> <caption><strong>Returned values Constants</strong></caption> <thead> <tr> <th><em><code class="parameter">imagetype</code></em></th> <th>Returned value</th> </tr> </thead> <tbody class="tbody"> <tr> <td><strong><code>IMAGETYPE_GIF</code></strong></td> <td><em>image/gif</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_JPEG</code></strong></td> <td><em>image/jpeg</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_PNG</code></strong></td> <td><em>image/png</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_SWF</code></strong></td> <td><em>application/x-shockwave-flash</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_PSD</code></strong></td> <td><em>image/psd</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_BMP</code></strong></td> <td><em>image/bmp</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_TIFF_II</code></strong> (intel byte order)</td> <td><em>image/tiff</em></td> </tr> <tr> <td> <strong><code>IMAGETYPE_TIFF_MM</code></strong> (motorola byte order) </td> <td><em>image/tiff</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_JPC</code></strong></td> <td><em>application/octet-stream</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_JP2</code></strong></td> <td><em>image/jp2</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_JPX</code></strong></td> <td><em>application/octet-stream</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_JB2</code></strong></td> <td><em>application/octet-stream</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_SWC</code></strong></td> <td><em>application/x-shockwave-flash</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_IFF</code></strong></td> <td><em>image/iff</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_WBMP</code></strong></td> <td><em>image/vnd.wap.wbmp</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_XBM</code></strong></td> <td><em>image/xbm</em></td> </tr> <tr> <td><strong><code>IMAGETYPE_ICO</code></strong></td> <td><em>image/vnd.microsoft.icon</em></td> </tr> </tbody> </table> </p> </div> <div class="refsect1 examples" id="refsect1-function.image-type-to-mime-type-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-3176"> <p><strong>Example #1 <span class="function"><strong>image_type_to_mime_type()</strong></span> example</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />header</span><span style="color: #007700">(</span><span style="color: #DD0000">"Content-type: " </span><span style="color: #007700">. </span><span style="color: #0000BB">image_type_to_mime_type</span><span style="color: #007700">(</span><span style="color: #0000BB">IMAGETYPE_PNG</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> </div> </p> </div> <div class="refsect1 notes" id="refsect1-function.image-type-to-mime-type-notes"> <h3 class="title">Notes</h3> <blockquote class="note"><p><strong class="note">Note</strong>: <p class="para">This function does not require the GD image library.</p></p></blockquote> </div> <div class="refsect1 seealso" id="refsect1-function.image-type-to-mime-type-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.getimagesize.html" class="function" rel="rdfs-seeAlso">getimagesize()</a> - Get the size of an image</span></li> <li class="member"> <span class="function"><a href="function.exif-imagetype.html" class="function" rel="rdfs-seeAlso">exif_imagetype()</a> - Determine the type of an image</span></li> <li class="member"> <span class="function"><a href="function.exif-read-data.html" class="function" rel="rdfs-seeAlso">exif_read_data()</a> - Reads the EXIF headers from JPEG or TIFF</span></li> <li class="member"> <span class="function"><a href="function.exif-thumbnail.html" class="function" rel="rdfs-seeAlso">exif_thumbnail()</a> - Retrieve the embedded thumbnail of a TIFF or JPEG image</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.image-type-to-extension.html">image_type_to_extension</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.image2wbmp.html">image2wbmp</a></div> <div class="up"><a href="ref.image.html">GD and Image Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>