Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > media > main > by-pkgid > 0afeee9cca140e167a996902b9a677c5 > files > 1082

php-manual-en-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>imagegif</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="index.html"><LINK
REL="UP"
TITLE="Image functions"
HREF="ref.image.html"><LINK
REL="PREVIOUS"
TITLE="imagegd"
HREF="function.imagegd.html"><LINK
REL="NEXT"
TITLE="imageinterlace"
HREF="function.imageinterlace.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.imagegd.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.imageinterlace.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.imagegif"
></A
>imagegif</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN35887"
></A
><P
>    (PHP 3, PHP 4 )</P
>imagegif&nbsp;--&nbsp;Output image to browser or file</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN35890"
></A
><H2
>Description</H2
>int <B
CLASS="methodname"
>imagegif</B
> ( resource image [, string filename])<BR
></BR
><P
>&#13;     <B
CLASS="function"
>imagegif()</B
> creates the <SPAN
CLASS="acronym"
>GIF</SPAN
>
     file in filename from the image <TT
CLASS="parameter"
><I
>image</I
></TT
>. The
     <TT
CLASS="parameter"
><I
>image</I
></TT
> argument is the return from the
     <A
HREF="function.imagecreate.html"
><B
CLASS="function"
>imagecreate()</B
></A
> function.
    </P
><P
>&#13;     The image format will be <SPAN
CLASS="acronym"
>GIF87a</SPAN
> unless the
     image has been made transparent with
     <A
HREF="function.imagecolortransparent.html"
><B
CLASS="function"
>imagecolortransparent()</B
></A
>, in which case the
     image format will be <SPAN
CLASS="acronym"
>GIF89a</SPAN
>.
    </P
><P
>&#13;     The filename argument is optional, and if left off, the raw image
     stream will be output directly.  By sending an image/gif
     content-type using <A
HREF="function.header.html"
><B
CLASS="function"
>header()</B
></A
>, you can create a
     PHP script that outputs <SPAN
CLASS="acronym"
>GIF</SPAN
> images directly.
     <DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       Since all <SPAN
CLASS="acronym"
>GIF</SPAN
> support was removed from the
       <SPAN
CLASS="acronym"
>GD</SPAN
> library in version 1.6, this function is
       not available if you are using that version of the GD library.
      </P
><P
>&#13;       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 <TT
CLASS="literal"
>header ("Content-type: image/gif");
       imagegif ($im);</TT
> by the more flexible sequence:
       <DIV
CLASS="informalexample"
><A
NAME="AEN35920"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?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");
?&#62;</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
      </P
></BLOCKQUOTE
></DIV
>
     <DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Note: </B
>
       As of version 3.0.18 and 4.0.2 you can use the function
       <A
HREF="function.imagetypes.html"
><B
CLASS="function"
>imagetypes()</B
></A
> in place of
       <A
HREF="function.function-exists.html"
><B
CLASS="function"
>function_exists()</B
></A
> for checking
       the presence of the various supported image formats:
       <DIV
CLASS="informalexample"
><A
NAME="AEN35926"
></A
><P
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>if (imagetypes() &#38; IMG_GIF) {
    header ("Content-type: image/gif");
    imagegif ($im);
}
elseif (imagetypes() &#38; IMG_JPG) {
        ... etc.</PRE
></TD
></TR
></TABLE
><P
></P
></DIV
>
      </P
></BLOCKQUOTE
></DIV
>
    </P
><P
>&#13;     See also <A
HREF="function.imagepng.html"
><B
CLASS="function"
>imagepng()</B
></A
>, <A
HREF="function.imagewbmp.html"
><B
CLASS="function"
>imagewbmp()</B
></A
>,
     <A
HREF="function.imagejpeg.html"
><B
CLASS="function"
>imagejpeg()</B
></A
>, <A
HREF="function.imagetypes.html"
><B
CLASS="function"
>imagetypes()</B
></A
>.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.imagegd.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.imageinterlace.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>imagegd</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.image.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>imageinterlace</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>