<?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 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.exif-imagetype.php',
    1 => 'exif_imagetype',
    2 => 'イメージの型を定義する',
  ),
  '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' => 'ja',
    '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">イメージの型を定義する</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="simpara">
    <span class="function"><strong>exif_imagetype()</strong></span> を画像の先頭バイトを読み
    そのサインを調べます。
   </p>
   <p class="simpara">
    <span class="function"><strong>exif_imagetype()</strong></span> は、他の
    <a href="ref.exif.php" class="link">exif</a> 関数がサポートしていないファイル形式で
    コールされるの防いだり、<var class="varname"><a href="reserved.variables.server.php" class="classname">$_SERVER['HTTP_ACCEPT']</a></var>
    と組み合わせて閲覧者が画像を見る権限を持っているかどうかを調べたりするために
    使用可能です。
   </p>
  </div>

  <div class="refsect1 parameters" id="refsect1-function.exif-imagetype-parameters">
   <h3 class="title">パラメータ</h3>
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <span class="simpara">
       調べる画像。
      </span>
     </dd>
    
   </dl>
  </div>

  <div class="refsect1 returnvalues" id="refsect1-function.exif-imagetype-returnvalues">
   <h3 class="title">戻り値</h3>
   <p class="simpara">
    正しいサインが見つかった場合は適切な定数、それ以外の場合は <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>
    を返します。戻り値は <span class="function"><a href="function.getimagesize.php" class="function">getimagesize()</a></span> がインデックス
    2 に対して返す値と同じですが、<span class="function"><strong>exif_imagetype()</strong></span>
    のほうがずっと早く動作します。
   </p>
   <p class="para">
    以下の定数が定義されており、<span class="function"><strong>exif_imagetype()</strong></span>
    の戻り値を表しています。
    <table class="doctable table">
    <caption><strong>Imagetype 定数</strong></caption>
     
      <thead>
       <tr>
        <th>値</th>
        <th>定数</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>: 
    <span class="simpara">
     画像の形式を判別するために必要なだけのバイト数を読み込めない場合、
     <span class="function"><strong>exif_imagetype()</strong></span> は <strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong>
     を発行して <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
     
    </span>
   </p></blockquote>
  </div>

  <div class="refsect1 changelog" id="refsect1-function.exif-imagetype-changelog">
   <h3 class="title">変更履歴</h3>
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>バージョン</th>
       <th>説明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>7.1.0</td>
       <td>
        WebP をサポートしました
       </td>
      </tr>

      <tr>
       <td>8.1.0</td>
       <td>
        AVIF をサポートしました。
       </td>
      </tr>

     </tbody>
    
   </table>

  </div>

  <div class="refsect1 examples" id="refsect1-function.exif-imagetype-examples">
   <h3 class="title">例</h3>
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>exif_imagetype()</strong></span> の例</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>
  </div>

  <div class="refsect1 seealso" id="refsect1-function.exif-imagetype-seealso">
   <h3 class="title">参考</h3>
   <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> - getimagesize, exif_read_data, exif_thumbnail, exif_imagetypeから返される
   画像形式のMIMEタイプを取得する</span></li>
    <li><span class="function"><a href="function.getimagesize.php" class="function" rel="rdfs-seeAlso">getimagesize()</a> - 画像の大きさを取得する</span></li>
   </ul>
  </div>

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