<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.exif.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'function.exif-imagetype.php',
    1 => 'exif_imagetype',
    2 => 'Determine the type of an image',
  ),
  'up' => 
  array (
    0 => 'ref.exif.php',
    1 => 'Функції Exif',
  ),
  'prev' => 
  array (
    0 => 'ref.exif.php',
    1 => 'Функції Exif',
  ),
  'next' => 
  array (
    0 => 'function.exif-read-data.php',
    1 => 'exif_read_data',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/exif/functions/exif-imagetype.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.exif-imagetype" class="refentry">
  <div class="refnamediv">
   <h1 class="refname">exif_imagetype</h1>
   <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">exif_imagetype</span> &mdash; <span class="dc-title">Determine the type of an image</span></p>

  </div>
  <div class="refsect1 description" id="refsect1-function.exif-imagetype-description">
   <h3 class="title">Опис</h3>
   <div class="methodsynopsis dc-description">
    <span class="methodname"><strong>exif_imagetype</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>): <span class="type"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

   <p class="para rdfs-comment">
    <span class="function"><strong>exif_imagetype()</strong></span> reads the first bytes of an image and
    checks its signature.
   </p>
   <p class="para">
    <span class="function"><strong>exif_imagetype()</strong></span> can be used to avoid calls to other 
    <a href="ref.exif.php" class="link">exif</a> functions with unsupported file types 
    or in conjunction with <var class="varname"><a href="reserved.variables.server.php" class="classname">$_SERVER['HTTP_ACCEPT']</a></var> to check 
    whether or not the viewer is able to see a specific image in the browser.
   </p>
  </div>

  <div class="refsect1 parameters" id="refsect1-function.exif-imagetype-parameters">
   <h3 class="title">Параметри</h3>
   <p class="para">
    <dl>
     
      <dt><code class="parameter">filename</code></dt>
      <dd>
       <span class="simpara">
        The image being checked.
       </span>
      </dd>
     
    </dl>
   </p>
  </div>

  <div class="refsect1 returnvalues" id="refsect1-function.exif-imagetype-returnvalues">
   <h3 class="title">Значення, що повертаються</h3>
   <p class="para">
    When a correct signature is found, the appropriate constant value will be
    returned otherwise the return value is <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>. The return value is the
    same value that <span class="function"><a href="function.getimagesize.php" class="function">getimagesize()</a></span> returns in index 2 but
    <span class="function"><strong>exif_imagetype()</strong></span> is much faster.
   </p>
   <p class="para">
    The following constants are defined, and represent possible 
    <span class="function"><strong>exif_imagetype()</strong></span> return values:
    <table class="doctable table">
    <caption><strong>Imagetype Constants</strong></caption>
     
      <thead>
       <tr>
        <th>Value</th>
        <th>Constant</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>1</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-gif">IMAGETYPE_GIF</a></code></strong></td>
       </tr>

       <tr>
        <td>2</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-jpeg">IMAGETYPE_JPEG</a></code></strong></td>
       </tr>

       <tr>
        <td>3</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-png">IMAGETYPE_PNG</a></code></strong></td>
       </tr>

       <tr>
        <td>4</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-swf">IMAGETYPE_SWF</a></code></strong></td>
       </tr>
        
       <tr>
        <td>5</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-psd">IMAGETYPE_PSD</a></code></strong></td>
       </tr>
        
       <tr>
        <td>6</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-bmp">IMAGETYPE_BMP</a></code></strong></td>
       </tr>
        
       <tr>
        <td>7</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-tiff-ii">IMAGETYPE_TIFF_II</a></code></strong> (intel byte order)</td>
       </tr>
        
       <tr>
        <td>8</td>
        <td>
         <strong><code><a href="image.constants.php#constant.imagetype-tiff-mm">IMAGETYPE_TIFF_MM</a></code></strong> (motorola byte order)
        </td>
       </tr>
      
       <tr>
        <td>9</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-jpc">IMAGETYPE_JPC</a></code></strong></td>
       </tr>
      
       <tr>
        <td>10</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-jp2">IMAGETYPE_JP2</a></code></strong></td>
       </tr>
      
       <tr>
        <td>11</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-jpx">IMAGETYPE_JPX</a></code></strong></td>
       </tr>

       <tr>
        <td>12</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-jb2">IMAGETYPE_JB2</a></code></strong></td>
       </tr>

       <tr>
        <td>13</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-swc">IMAGETYPE_SWC</a></code></strong></td>
       </tr>

       <tr>
        <td>14</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-iff">IMAGETYPE_IFF</a></code></strong></td>
       </tr>

       <tr>
        <td>15</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-wbmp">IMAGETYPE_WBMP</a></code></strong></td>
       </tr>

       <tr>
        <td>16</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-xbm">IMAGETYPE_XBM</a></code></strong></td>
       </tr>

       <tr>
        <td>17</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-ico">IMAGETYPE_ICO</a></code></strong></td>
       </tr>

       <tr>
        <td>18</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-webp">IMAGETYPE_WEBP</a></code></strong></td>
       </tr>

       <tr>
        <td>19</td>
        <td><strong><code><a href="image.constants.php#constant.imagetype-avif">IMAGETYPE_AVIF</a></code></strong></td>
       </tr>

      </tbody>
          
    </table>
       
   </p>

   <blockquote class="note"><p><strong class="note">Зауваження</strong>: 
    <p class="para">
     <span class="function"><strong>exif_imagetype()</strong></span> will emit an <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong>
     and return <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if it is unable to read enough bytes from the file to
     determine the image type.
     
    </p>
   </p></blockquote>

  </div>

  <div class="refsect1 changelog" id="refsect1-function.exif-imagetype-changelog">
   <h3 class="title">Журнал змін</h3>
   <p class="para">
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>Версія</th>
        <th>Опис</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>7.1.0</td>
        <td>
         Added WebP support.
        </td>
       </tr>

       <tr>
        <td>8.1.0</td>
        <td>
         Added AVIF support.
        </td>
       </tr>

      </tbody>
     
    </table>

   </p>
  </div>


  <div class="refsect1 examples" id="refsect1-function.exif-imagetype-examples">
   <h3 class="title">Приклади</h3>
   <p class="para">
    <div class="example" id="example-1">
     <p><strong>Приклад #1 <span class="function"><strong>exif_imagetype()</strong></span> example</strong></p>
     <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">exif_imagetype</span><span style="color: #007700">(</span><span style="color: #DD0000">'image.gif'</span><span style="color: #007700">) != </span><span style="color: #0000BB">IMAGETYPE_GIF</span><span style="color: #007700">) {<br />    echo </span><span style="color: #DD0000">'The picture is not a gif'</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>  
     </div>

    </div>
   </p>
  </div>

  <div class="refsect1 seealso" id="refsect1-function.exif-imagetype-seealso">
   <h3 class="title">Прогляньте також</h3>
   <p class="para">
    <ul class="simplelist">
     <li><span class="function"><a href="function.image-type-to-mime-type.php" class="function" rel="rdfs-seeAlso">image_type_to_mime_type()</a> - Get Mime-Type for image-type returned by getimagesize,
   exif_read_data, exif_thumbnail, exif_imagetype</span></li>
     <li><span class="function"><a href="function.getimagesize.php" class="function" rel="rdfs-seeAlso">getimagesize()</a> - Get the size of an image</span></li>
    </ul>
   </p>
  </div>

 </div><?php manual_footer($setup); ?>