example with image_type_to_mime_type

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@92295 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Marcus Boerger 2002-08-16 16:43:45 +00:00
parent 2272852e58
commit c991f19c79

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/image.xml, last change in rev 1.78 -->
<refentry id="function.exif-thumbnail">
<refnamediv>
@ -13,6 +13,7 @@
<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
@ -20,12 +21,40 @@
will be returned.
</para>
<para>
Both parameters <parameter>width</parameter> and <parameter>height</parameter> are
available since PHP 4.3 and return the size of the thumbnail. It is possible that
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.
@ -41,7 +70,7 @@
This function does not require the GD image library.
</simpara>
<simpara>
See also <function>exif_read_data</function>.
See also <function>exif_read_data</function> and <function>image_type_to_mime_type</function>.
</simpara>
</note>
</para>