<?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 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.exif-thumbnail.php',
    1 => 'exif_thumbnail',
    2 => '检索图像的嵌入式缩略图',
  ),
  'up' => 
  array (
    0 => 'ref.exif.php',
    1 => 'Exif 函数',
  ),
  'prev' => 
  array (
    0 => 'function.exif-tagname.php',
    1 => 'exif_tagname',
  ),
  'next' => 
  array (
    0 => 'function.read-exif-data.php',
    1 => 'read_exif_data',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'reference/exif/functions/exif-thumbnail.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.exif-thumbnail" class="refentry">
  <div class="refnamediv">
   <h1 class="refname">exif_thumbnail</h1>
   <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">exif_thumbnail</span> &mdash; <span class="dc-title">检索图像的嵌入式缩略图</span></p>

  </div>
 <div class="refsect1 description" id="refsect1-function.exif-thumbnail-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>exif_thumbnail</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span></span> <code class="parameter">$file</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter reference">&$width</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter reference">&$height</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter reference">&$image_type</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</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_thumbnail()</strong></span> 读取图像的嵌入式缩略图。
</p>
  <p class="simpara">
   如果想通过该函数发送缩略图，应该使用 <span class="function"><a href="function.header.php" class="function">header()</a></span> 函数发送 mimetype 信息。
   </p>
  <p class="simpara">
   <span class="function"><strong>exif_thumbnail()</strong></span> 不能创建图像但能确定它的尺寸。在这种情况下，返回值是
   <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>，但会设置 <code class="parameter">width</code> 和 <code class="parameter">height</code>。
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.exif-thumbnail-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt><code class="parameter">file</code></dt>
    <dd>
     <span class="simpara">
      图像文件的路径。可以是文件路径也可以是流 <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>。
     </span>
    </dd>
   
   
    <dt><code class="parameter">width</code></dt>
    <dd>
     <span class="simpara">
      返回缩略图的宽度。
     </span>
    </dd>
   
   
    <dt><code class="parameter">height</code></dt>
    <dd>
     <span class="simpara">
      返回缩略图的高度。
     </span>
    </dd>
   
   
    <dt><code class="parameter">image_type</code></dt>
    <dd>
     <span class="simpara">
      返回缩略图的图像类型。不是 <abbr title="Tagged Image File Format">TIFF</abbr> 就是 <abbr title="Joint Photographic Experts Group">JPEG</abbr>。
     </span>
    </dd>
   
  </dl>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.exif-thumbnail-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="simpara">
   返回嵌入式缩略图，如果图像不包含缩略图则返回 <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>。
  </p>
 </div>

 <div class="refsect1 changelog" id="refsect1-function.exif-thumbnail-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td>7.2.0</td>
      <td>
       <code class="parameter">file</code> 参数现在支持本地文件和流资源。
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.exif-thumbnail-examples">
  <h3 class="title">示例</h3>
  <div class="example" id="example-1">
    <p><strong>示例 #1 <span class="function"><strong>exif_thumbnail()</strong></span> 示例</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$image </span><span style="color: #007700">= </span><span style="color: #0000BB">exif_thumbnail</span><span style="color: #007700">(</span><span style="color: #DD0000">'/path/to/image.jpg'</span><span style="color: #007700">, </span><span style="color: #0000BB">$width</span><span style="color: #007700">, </span><span style="color: #0000BB">$height</span><span style="color: #007700">, </span><span style="color: #0000BB">$type</span><span style="color: #007700">);<br /><br />if (</span><span style="color: #0000BB">$image</span><span style="color: #007700">!==</span><span style="color: #0000BB">false</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">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">$type</span><span style="color: #007700">));<br />    echo </span><span style="color: #0000BB">$image</span><span style="color: #007700">;<br />    exit;<br />} else {<br />    </span><span style="color: #FF8000">// 没有可用的缩略图，这里处理错误<br />    </span><span style="color: #007700">echo </span><span style="color: #DD0000">'No thumbnail available'</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
 </div>


 <div class="refsect1 notes" id="refsect1-function.exif-thumbnail-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">注意</strong>: 
   <span class="simpara">
    如果传递流到此函数的 <code class="parameter">file</code>，然后流必须是可寻找的。请注意，此函数返回后，文件指针位置不会改变。
   </span>
  </p></blockquote>
 </div>

 <div class="refsect1 seealso" id="refsect1-function.exif-thumbnail-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li><span class="function"><a href="function.exif-read-data.php" class="function" rel="rdfs-seeAlso">exif_read_data()</a> - 从一个图片文件中读取 EXIF 头信息</span></li>
   <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>
  </ul>
 </div>

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