mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-29 07:18:55 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@239698 c90b9560-bf6c-de11-be94-00142212c4b1
150 lines
4.4 KiB
XML
150 lines
4.4 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.18 $ -->
|
|
<refentry xml:id="function.imagegif" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>imagegif</refname>
|
|
<refpurpose>Output image to browser or file</refpurpose>
|
|
</refnamediv>
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<type>bool</type><methodname>imagegif</methodname>
|
|
<methodparam><type>resource</type><parameter>image</parameter></methodparam>
|
|
<methodparam choice="opt"><type>string</type><parameter>filename</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>imagegif</function> creates the <acronym>GIF</acronym>
|
|
file in filename from the image <parameter>image</parameter>. The
|
|
<parameter>image</parameter> argument is the return from the
|
|
<function>imagecreate</function> or <literal>imagecreatefrom*</literal>
|
|
function.
|
|
</para>
|
|
<para>
|
|
The image format will be <acronym>GIF87a</acronym> unless the
|
|
image has been made transparent with
|
|
<function>imagecolortransparent</function>, in which case the
|
|
image format will be <acronym>GIF89a</acronym>.
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
&gd.image.description;
|
|
<varlistentry>
|
|
<term><parameter>filename</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
The path to save the file to. If not set or &null;, the raw image stream
|
|
will be outputted directly.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
&return.success;
|
|
</para>
|
|
</refsect1>
|
|
<refsect1 role="notes">
|
|
&reftitle.notes;
|
|
<note>
|
|
<para>
|
|
Since all <acronym>GIF</acronym> support was removed from the
|
|
<acronym>GD</acronym> library in version 1.6, this function is
|
|
not available if you are using that version of the GD library.
|
|
Support is expected to return in a version subsequent to the
|
|
rerelease of <acronym>GIF</acronym> support in the GD library in
|
|
mid 2004. For more information, see the
|
|
<link xlink:href="&url.gd;">GD Project</link> site.
|
|
</para>
|
|
<para>
|
|
The following code snippet allows you to write more
|
|
portable PHP applications by auto-detecting the
|
|
type of GD support which is available. Replace
|
|
the sequence <literal>header ("Content-type: image/gif");
|
|
imagegif ($im);</literal> by the more flexible sequence:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if (function_exists("imagegif")) {
|
|
header("Content-type: image/gif");
|
|
imagegif($im);
|
|
} elseif (function_exists("imagejpeg")) {
|
|
header("Content-type: image/jpeg");
|
|
imagejpeg($im, "", 0.5);
|
|
} elseif (function_exists("imagepng")) {
|
|
header("Content-type: image/png");
|
|
imagepng($im);
|
|
} elseif (function_exists("imagewbmp")) {
|
|
header("Content-type: image/vnd.wap.wbmp");
|
|
imagewbmp($im);
|
|
} else {
|
|
die("No image support in this PHP server");
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</note>
|
|
<note>
|
|
<para>
|
|
As of version 3.0.18 and 4.0.2 you can use the function
|
|
<function>imagetypes</function> in place of
|
|
<function>function_exists</function> for checking
|
|
the presence of the various supported image formats:
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
if (imagetypes() & IMG_GIF) {
|
|
header ("Content-type: image/gif");
|
|
imagegif ($im);
|
|
} elseif (imagetypes() & IMG_JPG) {
|
|
/* ... etc. */
|
|
}
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
</note>
|
|
</refsect1>
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><function>imagepng</function></member>
|
|
<member><function>imagewbmp</function></member>
|
|
<member><function>imagejpeg</function></member>
|
|
<member><function>imagetypes</function></member>
|
|
</simplelist>
|
|
</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
|
|
-->
|