php-doc-en/reference/image/functions/exif-thumbnail.xml
Marcus Boerger c991f19c79 example with image_type_to_mime_type
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@92295 c90b9560-bf6c-de11-be94-00142212c4b1
2002-08-16 16:43:45 +00:00

99 lines
3.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.78 -->
<refentry id="function.exif-thumbnail">
<refnamediv>
<refname>exif_thumbnail</refname>
<refpurpose>Retrieve the embedded thumbnail of a TIFF or JPEG image</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>string</type><methodname>exif_thumbnail</methodname>
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>&amp;width</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>&amp;height</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>&amp;imagetype</parameter></methodparam>
</methodsynopsis>
<para>
<function>exif_thumbnail</function> reads the embedded thumbnail of
a TIFF or JPEG image. If the image contains no thumbnail &false;
will be returned.
</para>
<para>
The parameters <parameter>width</parameter>, <parameter>height</parameter> and
<parameter>imagetype</parameter> are available since PHP 4.3 and return the size
of the thumbnail as well as its type. It is possible that
<function>exif_thumbnail</function> cannot create an image but determine its
size. In this case the return value is &false; but <parameter>width</parameter> and
<parameter>height</parameter> are set.
</para>
<para>
If you want to deliver thumbnails through this function you should send the
mimetype information using <function>header</function> function. The following
example demonstrates this:
<example>
<title><function>exif_thumbnail</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
if (array_key_exists('file',$_REQUEST)) {
$image = exif_thumbnail($_REQUEST['file'], $width, $height, $type);
} else {
$image = false;
}
if ($image!==false) {
header("Content-type: ".image_type_to_mime_type($type));
echo $image;
exit;
} else {
// no thumbnail available, handle the error here
echo "No thumbnail available";
}
?>
]]>
</programlisting>
</example>
</para>
<para>
Starting from version PHP 4.3 the function <function>exif_thumbnail</function> can
return thumbnails in <acronym>TIFF</acronym> format.
</para>
<para>
<note>
<simpara>
This function is only available in PHP 4 compiled using
<option role="configure">--enable-exif</option>.
Its functionality and behaviour has changed in PHP 4.2
</simpara>
<simpara>
This function does not require the GD image library.
</simpara>
<simpara>
See also <function>exif_read_data</function> and <function>image_type_to_mime_type</function>.
</simpara>
</note>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->