<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML ><HEAD ><TITLE >Image Functions</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual PHP" HREF="index.html"><LINK REL="UP" TITLE="Documentaþia funcþiilor" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="ob_iconv_handler" HREF="function.ob-iconv-handler.html"><LINK REL="NEXT" TITLE="exif_imagetype" HREF="function.exif-imagetype.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-2"></HEAD ><BODY CLASS="reference" 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" >Manual PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.ob-iconv-handler.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.exif-imagetype.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.image" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >XLII. Image Functions</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN37406" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="image.intro" >Introducere</A ></H1 ><P > PHP is not limited to creating just HTML output. It can also be used to create and manipulate image files in a variety of different image formats, including gif, png, jpg, wbmp, and xpm. Even more convenient, PHP can output image streams directly to a browser. You will need to compile PHP with the GD library of image functions for this to work. GD and PHP may also require other libraries, depending on which image formats you want to work with. </P ><P > You can use the image functions in PHP to get the size of <ACRONYM CLASS="acronym" >JPEG</ACRONYM >, <ACRONYM CLASS="acronym" >GIF</ACRONYM >, <ACRONYM CLASS="acronym" >PNG</ACRONYM >, <ACRONYM CLASS="acronym" >SWF</ACRONYM >, <ACRONYM CLASS="acronym" >TIFF</ACRONYM > and <ACRONYM CLASS="acronym" >JPEG2000</ACRONYM > images. </P ><P > <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > Read requirements section about how to expand image capabilities to read, write and modify images and to read meta data of pictures taken by digital cameras. </P ></BLOCKQUOTE ></DIV > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="image.requirements" >Necesitãþi</A ></H1 ><P > If you have the <ACRONYM CLASS="acronym" >GD</ACRONYM > library (available at <A HREF="http://www.boutell.com/gd/" TARGET="_top" >http://www.boutell.com/gd/</A >) you will also be able to create and manipulate images. </P ><P > The format of images you are able to manipulate depend on the version of <ACRONYM CLASS="acronym" >GD</ACRONYM > you install, and any other libraries <ACRONYM CLASS="acronym" >GD</ACRONYM > might need to access those image formats. Versions of <ACRONYM CLASS="acronym" >GD</ACRONYM > older than gd-1.6 support GIF format images, and do not support PNG, where versions greater than gd-1.6 support PNG, not GIF. <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > Since PHP 4.3 there is a bundled version of the GD lib. This bundled version has some additional features like alpha blending, and should be used in preference to the external library since its codebase is better maintained and more stable. </P ></BLOCKQUOTE ></DIV > </P ><P > You may wish to enhance GD to handle more image formats. <DIV CLASS="table" ><A NAME="AEN37432" ></A ><P ><B >Tabel 1. Supported image formats</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Image format</TH ><TH >Library to download</TH ><TH >Notes</TH ></TR ></THEAD ><TBODY ><TR ><TD ><VAR CLASS="literal" >gif</VAR ></TD ><TD > </TD ><TD > Only supported in GD versions older than gd-1.6. <SPAN CLASS="emphasis" ><I CLASS="emphasis" >Read-only </I ></SPAN > GIF support is available with PHP 4.3.0 and the bundled GD-library. </TD ></TR ><TR ><TD ><VAR CLASS="literal" >jpeg-6b</VAR ></TD ><TD ><A HREF="ftp://ftp.uu.net/graphics/jpeg/" TARGET="_top" >ftp://ftp.uu.net/graphics/jpeg/</A ></TD ><TD > </TD ></TR ><TR ><TD ><VAR CLASS="literal" >png</VAR ></TD ><TD ><A HREF="http://www.libpng.org/pub/png/libpng.html" TARGET="_top" >http://www.libpng.org/pub/png/libpng.html</A ></TD ><TD > Only supported in GD versions greater than gd-1.6. </TD ></TR ><TR ><TD ><VAR CLASS="literal" >xpm</VAR ></TD ><TD ><A HREF="ftp://metalab.unc.edu/pub/Linux/libs/X/!INDEX.html" TARGET="_top" >ftp://metalab.unc.edu/pub/Linux/libs/X/!INDEX.html</A ></TD ><TD > It's likely you have this library already available, if your system has an installed X-Environment. </TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > You may wish to enhance GD to deal with different fonts. The following font libraries are supported: <DIV CLASS="table" ><A NAME="AEN37466" ></A ><P ><B >Tabel 2. Supported font libraries</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Font library</TH ><TH >Download</TH ><TH >Notes</TH ></TR ></THEAD ><TBODY ><TR ><TD ><VAR CLASS="literal" >FreeType 1.x</VAR ></TD ><TD ><A HREF="http://www.freetype.org/" TARGET="_top" >http://www.freetype.org/</A ></TD ><TD > </TD ></TR ><TR ><TD ><VAR CLASS="literal" >FreeType 2</VAR ></TD ><TD ><A HREF="http://www.freetype.org/" TARGET="_top" >http://www.freetype.org/</A ></TD ><TD > </TD ></TR ><TR ><TD ><VAR CLASS="literal" >T1lib</VAR ></TD ><TD ><A HREF="ftp://sunsite.unc.edu/pub/Linux/libs/graphics/" TARGET="_top" >ftp://sunsite.unc.edu/pub/Linux/libs/graphics/</A >)</TD ><TD > Support for Type 1 fonts. </TD ></TR ></TBODY ></TABLE ></DIV > </P ><P > If you have PHP compiled with <VAR CLASS="option" >--enable-exif</VAR > you are able to work with information stored in headers of <ACRONYM CLASS="acronym" >JPEG</ACRONYM > and <ACRONYM CLASS="acronym" >TIFF</ACRONYM > images. This way you can read meta data generated by digital cameras as mentioned above. These functions do not require the <ACRONYM CLASS="acronym" >GD</ACRONYM > library. <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > PHP does not require any additional library for the exif module. </P ></BLOCKQUOTE ></DIV > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="image.installation" >Instalare</A ></H1 ><P > To enable GD-support configure PHP <VAR CLASS="option" >--with-gd[=DIR]</VAR >, where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option <VAR CLASS="option" >--with-gd</VAR >. </P ><P > In Windows, you'll include the GD2 DLL <TT CLASS="filename" >php_gd2.dll</TT > as an extension in <TT CLASS="filename" >php.ini</TT >. The GD1 DLL <TT CLASS="filename" >php_gd.dll</TT > was removed in PHP 4.3.2. Also note that the preferred truecolor image functions, such as <A HREF="function.imagecreatetruecolor.html" ><B CLASS="function" >imagecreatetruecolor()</B ></A >, require GD2. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > To enable exif support in Windows, php_mbstring.dll must be loaded prior to php_exif.dll in php.ini. </P ></BLOCKQUOTE ></DIV ><P > To disable GD support in <SPAN CLASS="emphasis" ><I CLASS="emphasis" >PHP 3</I ></SPAN > add <VAR CLASS="option" >--without-gd</VAR > to your configure line. </P ><P > Enhance the capabilities of GD to handle more image formats by specifying the <VAR CLASS="literal" >--with-XXXX</VAR > configure switch to your PHP configure line. <DIV CLASS="table" ><A NAME="AEN37517" ></A ><P ><B >Tabel 3. Supported image formats</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Image Format</TH ><TH >Configure Switch</TH ></TR ></THEAD ><TBODY ><TR ><TD ><VAR CLASS="literal" >jpeg-6b</VAR ></TD ><TD > To enable support for jpeg-6b add <VAR CLASS="option" >--with-jpeg-dir=DIR</VAR >. </TD ></TR ><TR ><TD ><VAR CLASS="literal" >png</VAR ></TD ><TD > To enable support for png add <VAR CLASS="option" >--with-png-dir=DIR</VAR >. Note, libpng requires the <A HREF="ref.zlib.html#zlib.requirements" >zlib library</A >, therefore add <VAR CLASS="option" >--with-zlib-dir[=DIR]</VAR > to your configure line. </TD ></TR ><TR ><TD ><VAR CLASS="literal" >xpm</VAR ></TD ><TD > To enable support for xpm add <VAR CLASS="option" >--with-xpm-dir=DIR</VAR >. If configure is not able to find the required libraries, you may add the path to your X11 libraries. </TD ></TR ></TBODY ></TABLE ></DIV > <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Notã: </B > When compiling PHP with libpng, you must use the same version that was linked with the GD library. </P ></BLOCKQUOTE ></DIV > </P ><P > Enhance the capabilities of GD to deal with different fonts by specifying the <VAR CLASS="literal" >--with-XXXX</VAR > configure switch to your PHP configure line. <DIV CLASS="table" ><A NAME="AEN37546" ></A ><P ><B >Tabel 4. Supported font libraries</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><THEAD ><TR ><TH >Font library</TH ><TH >Configure Switch</TH ></TR ></THEAD ><TBODY ><TR ><TD ><VAR CLASS="literal" >FreeType 1.x</VAR ></TD ><TD > To enable support for FreeType 1.x add <VAR CLASS="option" >--with-ttf[=DIR]</VAR >. </TD ></TR ><TR ><TD ><VAR CLASS="literal" >FreeType 2</VAR ></TD ><TD > To enable support for FreeType 2 add <VAR CLASS="option" >--with-freetype-dir=DIR</VAR >. </TD ></TR ><TR ><TD ><VAR CLASS="literal" >T1lib</VAR ></TD ><TD > To enable support for T1lib (Type 1 fonts) add <VAR CLASS="option" >--with-t1lib[=DIR]</VAR >. </TD ></TR ><TR ><TD ><VAR CLASS="literal" >Native TrueType string function</VAR ></TD ><TD > To enable support for native TrueType string function add <VAR CLASS="option" >--enable-gd-native-ttf</VAR >. </TD ></TR ></TBODY ></TABLE ></DIV > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="image.configuration" >Configurare la rulare</A ></H1 ><P > The behaviour of these functions is affected by settings in <TT CLASS="filename" >php.ini</TT >. </P ><P > Exif supports automatically conversion for Unicode and JIS character encodings of user comments when module <A HREF="ref.mbstring.html" >mbstring</A > is available. This is done by first decoding the comment using the specified characterset. The result is then encoded with another characterset which should match your <VAR CLASS="literal" >HTTP</VAR > output. <DIV CLASS="table" ><A NAME="AEN37581" ></A ><P ><B >Tabel 5. Exif configuration options</B ></P ><TABLE BORDER="1" CLASS="CALSTABLE" ><COL><COL><COL><THEAD ><TR ><TH >Name</TH ><TH >Default</TH ><TH >Changeable</TH ></TR ></THEAD ><TBODY ><TR ><TD >exif.encode_unicode</TD ><TD >"ISO-8859-15"</TD ><TD >PHP_INI_ALL</TD ></TR ><TR ><TD >exif.decode_unicode_motorola</TD ><TD >"UCS-2BE"</TD ><TD >PHP_INI_ALL</TD ></TR ><TR ><TD >exif.decode_unicode_intel</TD ><TD >"UCS-2LE"</TD ><TD >PHP_INI_ALL</TD ></TR ><TR ><TD >exif.encode_jis</TD ><TD >""</TD ><TD >PHP_INI_ALL</TD ></TR ><TR ><TD >exif.decode_jis_motorola</TD ><TD >"JIS"</TD ><TD >PHP_INI_ALL</TD ></TR ><TR ><TD >exif.decode_jis_intel</TD ><TD >"JIS"</TD ><TD >PHP_INI_ALL</TD ></TR ></TBODY ></TABLE ></DIV > For further details and definition of the PHP_INI_* constants see <A HREF="function.ini-set.html" ><B CLASS="function" >ini_set()</B ></A >. </P ><P >Here's a short explanation of the configuration directives.</P ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><A NAME="ini.exif.encode-unicode" ></A ><VAR CLASS="parameter" >exif.encode_unicode</VAR > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > <VAR CLASS="literal" >exif.encode_unicode</VAR > defines the characterset UNICODE user comments are handled. This defaults to ISO-8859-15 which should work for most non Asian countries. The setting can be empty or must be an encoding supported by mbstring. If it is empty the current internal encoding of mbstring is used. </P ></DD ><DT ><A NAME="ini.exif.decode-unicode-motorola" ></A ><VAR CLASS="parameter" >exif.decode_unicode_motorola</VAR > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > <VAR CLASS="literal" >exif.decode_unicode_motorola</VAR > defines the image internal characterset for Unicode encoded user comments if image is in motorola byte order (big-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is UCS-2BE. </P ></DD ><DT ><A NAME="ini.exif.decode-unicode-intel" ></A ><VAR CLASS="parameter" >exif.decode_unicode_intel</VAR > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > <VAR CLASS="literal" >exif.decode_unicode_intel</VAR > defines the image internal characterset for Unicode encoded user comments if image is in intel byte order (little-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is UCS-2LE. </P ></DD ><DT ><A NAME="ini.exif.encode-jis" ></A ><VAR CLASS="parameter" >exif.encode_jis</VAR > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > <VAR CLASS="literal" >exif.encode_jis</VAR > defines the characterset JIS user comments are handled. This defaults to an empty value which forces the functions to use the current internal encoding of mbstring. </P ></DD ><DT ><A NAME="ini.exif.decode-jis-motorola" ></A ><VAR CLASS="parameter" >exif.decode_jis_motorola</VAR > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > <VAR CLASS="literal" >exif.decode_jis_motorola</VAR > defines the image internal characterset for JIS encoded user comments if image is in motorola byte order (big-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is JIS. </P ></DD ><DT ><A NAME="ini.exif.decode-jis-intel" ></A ><VAR CLASS="parameter" >exif.decode_jis_intel</VAR > <A HREF="language.types.string.html" ><B CLASS="type" >string</B ></A ></DT ><DD ><P > <VAR CLASS="literal" >exif.decode_jis_intel</VAR > defines the image internal characterset for JIS encoded user comments if image is in intel byte order (little-endian). This setting cannot be empty but you can specify a list of encodings supported by mbstring. The default is JIS. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="image.resources" >Tipuri de resurse</A ></H1 ><P >Aceastã extensie nu defineºte tipuri de resurse.</P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="image.constants" >Constante predefinite</A ></H1 ><P > Aceste constante sunt definite de aceastã extensie ºi vor fi disponibile doar cînd extensia a fost fie compilatã odatã la instalarea PHP fie dacã extensia este încãrcatã dinamic la rulare.</P ><P ></P ><DIV CLASS="variablelist" ><DL ><DT ><TT CLASS="constant" ><B >IMG_GIF</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_JPG</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_JPEG</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_PNG</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_WBMP</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_XPM</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_COLOR_TILED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_COLOR_STYLED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_COLOR_BRUSHED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_COLOR_STYLEDBRUSHED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_COLOR_TRANSPARENT</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_ARC_ROUNDED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_ARC_PIE</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_ARC_CHORD</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_ARC_NOFILL</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMG_ARC_EDGED</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_GIF</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_JPEG</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_PNG</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_SWF</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_PSD</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_BMP</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_WBMP</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_XBM</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_TIFF_II</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_TIFF_MM</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_IFF</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_JB2</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_JPC</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_JP2</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_JPX</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ><DT ><TT CLASS="constant" ><B >IMAGETYPE_SWC</B ></TT > (<A HREF="language.types.integer.html" ><B CLASS="type" >integer</B ></A >)</DT ><DD ><P > </P ></DD ></DL ></DIV ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="image.examples" >Exemple</A ></H1 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN37862" ></A ><P ><B >Exemplu 1. PNG creation with PHP</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> header</font><font color="#007700">(</font><font color="#DD0000">"Content-type: image/png"</font><font color="#007700">);<br /> </font><font color="#0000BB">$string </font><font color="#007700">= </font><font color="#0000BB">$_GET</font><font color="#007700">[</font><font color="#DD0000">'text'</font><font color="#007700">];<br /> </font><font color="#0000BB">$im </font><font color="#007700">= </font><font color="#0000BB">imagecreatefrompng</font><font color="#007700">(</font><font color="#DD0000">"images/button1.png"</font><font color="#007700">);<br /> </font><font color="#0000BB">$orange </font><font color="#007700">= </font><font color="#0000BB">imagecolorallocate</font><font color="#007700">(</font><font color="#0000BB">$im</font><font color="#007700">, </font><font color="#0000BB">220</font><font color="#007700">, </font><font color="#0000BB">210</font><font color="#007700">, </font><font color="#0000BB">60</font><font color="#007700">);<br /> </font><font color="#0000BB">$px </font><font color="#007700">= (</font><font color="#0000BB">imagesx</font><font color="#007700">(</font><font color="#0000BB">$im</font><font color="#007700">) - </font><font color="#0000BB">7.5 </font><font color="#007700">* </font><font color="#0000BB">strlen</font><font color="#007700">(</font><font color="#0000BB">$string</font><font color="#007700">)) / </font><font color="#0000BB">2</font><font color="#007700">;<br /> </font><font color="#0000BB">imagestring</font><font color="#007700">(</font><font color="#0000BB">$im</font><font color="#007700">, </font><font color="#0000BB">3</font><font color="#007700">, </font><font color="#0000BB">$px</font><font color="#007700">, </font><font color="#0000BB">9</font><font color="#007700">, </font><font color="#0000BB">$string</font><font color="#007700">, </font><font color="#0000BB">$orange</font><font color="#007700">);<br /> </font><font color="#0000BB">imagepng</font><font color="#007700">(</font><font color="#0000BB">$im</font><font color="#007700">);<br /> </font><font color="#0000BB">imagedestroy</font><font color="#007700">(</font><font color="#0000BB">$im</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > This example would be called from a page with a tag like: <img src="button.php?text=text">. The above button.php script then takes this "text" string and overlays it on top of a base image which in this case is "images/button1.png" and outputs the resulting image. This is a very convenient way to avoid having to draw new button images every time you want to change the text of a button. With this method they are dynamically generated. </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Cuprins</B ></DT ><DT ><A HREF="function.exif-imagetype.html" >exif_imagetype</A > -- Determine the type of an image</DT ><DT ><A HREF="function.exif-read-data.html" >exif_read_data</A > -- Reads the <ACRONYM CLASS="acronym" >EXIF</ACRONYM > headers from <ACRONYM CLASS="acronym" >JPEG</ACRONYM > or <ACRONYM CLASS="acronym" >TIFF</ACRONYM >. This way you can read meta data generated by digital cameras.</DT ><DT ><A HREF="function.exif-thumbnail.html" >exif_thumbnail</A > -- Retrieve the embedded thumbnail of a TIFF or JPEG image</DT ><DT ><A HREF="function.gd-info.html" >gd_info</A > -- Retrieve information about the currently installed GD library</DT ><DT ><A HREF="function.getimagesize.html" >getimagesize</A > -- Get the size of an image</DT ><DT ><A HREF="function.image-type-to-extension.html" >image_type_to_extension</A > -- Get file extension for image type </DT ><DT ><A HREF="function.image-type-to-mime-type.html" >image_type_to_mime_type</A > -- Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype</DT ><DT ><A HREF="function.image2wbmp.html" >image2wbmp</A > -- Output image to browser or file</DT ><DT ><A HREF="function.imagealphablending.html" >imagealphablending</A > -- Set the blending mode for an image</DT ><DT ><A HREF="function.imageantialias.html" >imageantialias</A > -- Should antialias functions be used or not </DT ><DT ><A HREF="function.imagearc.html" >imagearc</A > -- Draw a partial ellipse</DT ><DT ><A HREF="function.imagechar.html" >imagechar</A > -- Draw a character horizontally</DT ><DT ><A HREF="function.imagecharup.html" >imagecharup</A > -- Draw a character vertically</DT ><DT ><A HREF="function.imagecolorallocate.html" >imagecolorallocate</A > -- Allocate a color for an image</DT ><DT ><A HREF="function.imagecolorallocatealpha.html" >imagecolorallocatealpha</A > -- Allocate a color for an image</DT ><DT ><A HREF="function.imagecolorat.html" >imagecolorat</A > -- Get the index of the color of a pixel</DT ><DT ><A HREF="function.imagecolorclosest.html" >imagecolorclosest</A > -- Get the index of the closest color to the specified color</DT ><DT ><A HREF="function.imagecolorclosestalpha.html" >imagecolorclosestalpha</A > -- Get the index of the closest color to the specified color + alpha</DT ><DT ><A HREF="function.imagecolorclosesthwb.html" >imagecolorclosesthwb</A > -- Get the index of the color which has the hue, white and blackness nearest to the given color </DT ><DT ><A HREF="function.imagecolordeallocate.html" >imagecolordeallocate</A > -- De-allocate a color for an image</DT ><DT ><A HREF="function.imagecolorexact.html" >imagecolorexact</A > -- Get the index of the specified color</DT ><DT ><A HREF="function.imagecolorexactalpha.html" >imagecolorexactalpha</A > -- Get the index of the specified color + alpha</DT ><DT ><A HREF="function.imagecolormatch.html" >imagecolormatch</A > -- Makes the colors of the palette version of an image more closely match the true color version </DT ><DT ><A HREF="function.imagecolorresolve.html" >imagecolorresolve</A > -- Get the index of the specified color or its closest possible alternative </DT ><DT ><A HREF="function.imagecolorresolvealpha.html" >imagecolorresolvealpha</A > -- Get the index of the specified color + alpha or its closest possible alternative </DT ><DT ><A HREF="function.imagecolorset.html" >imagecolorset</A > -- Set the color for the specified palette index</DT ><DT ><A HREF="function.imagecolorsforindex.html" >imagecolorsforindex</A > -- Get the colors for an index</DT ><DT ><A HREF="function.imagecolorstotal.html" >imagecolorstotal</A > -- Find out the number of colors in an image's palette</DT ><DT ><A HREF="function.imagecolortransparent.html" >imagecolortransparent</A > -- Define a color as transparent</DT ><DT ><A HREF="function.imagecopy.html" >imagecopy</A > -- Copy part of an image</DT ><DT ><A HREF="function.imagecopymerge.html" >imagecopymerge</A > -- Copy and merge part of an image</DT ><DT ><A HREF="function.imagecopymergegray.html" >imagecopymergegray</A > -- Copy and merge part of an image with gray scale</DT ><DT ><A HREF="function.imagecopyresampled.html" >imagecopyresampled</A > -- Copy and resize part of an image with resampling</DT ><DT ><A HREF="function.imagecopyresized.html" >imagecopyresized</A > -- Copy and resize part of an image</DT ><DT ><A HREF="function.imagecreate.html" >imagecreate</A > -- Create a new palette based image</DT ><DT ><A HREF="function.imagecreatefromgd2.html" >imagecreatefromgd2</A > -- Create a new image from GD2 file or URL</DT ><DT ><A HREF="function.imagecreatefromgd2part.html" >imagecreatefromgd2part</A > -- Create a new image from a given part of GD2 file or URL</DT ><DT ><A HREF="function.imagecreatefromgd.html" >imagecreatefromgd</A > -- Create a new image from GD file or URL</DT ><DT ><A HREF="function.imagecreatefromgif.html" >imagecreatefromgif</A > -- Create a new image from file or URL</DT ><DT ><A HREF="function.imagecreatefromjpeg.html" >imagecreatefromjpeg</A > -- Create a new image from file or URL</DT ><DT ><A HREF="function.imagecreatefrompng.html" >imagecreatefrompng</A > -- Create a new image from file or URL</DT ><DT ><A HREF="function.imagecreatefromstring.html" >imagecreatefromstring</A > -- Create a new image from the image stream in the string</DT ><DT ><A HREF="function.imagecreatefromwbmp.html" >imagecreatefromwbmp</A > -- Create a new image from file or URL</DT ><DT ><A HREF="function.imagecreatefromxbm.html" >imagecreatefromxbm</A > -- Create a new image from file or URL</DT ><DT ><A HREF="function.imagecreatefromxpm.html" >imagecreatefromxpm</A > -- Create a new image from file or URL</DT ><DT ><A HREF="function.imagecreatetruecolor.html" >imagecreatetruecolor</A > -- Create a new true color image</DT ><DT ><A HREF="function.imagedashedline.html" >imagedashedline</A > -- Draw a dashed line</DT ><DT ><A HREF="function.imagedestroy.html" >imagedestroy</A > -- Destroy an image</DT ><DT ><A HREF="function.imageellipse.html" >imageellipse</A > -- Draw an ellipse</DT ><DT ><A HREF="function.imagefill.html" >imagefill</A > -- Flood fill</DT ><DT ><A HREF="function.imagefilledarc.html" >imagefilledarc</A > -- Draw a partial ellipse and fill it</DT ><DT ><A HREF="function.imagefilledellipse.html" >imagefilledellipse</A > -- Draw a filled ellipse</DT ><DT ><A HREF="function.imagefilledpolygon.html" >imagefilledpolygon</A > -- Draw a filled polygon</DT ><DT ><A HREF="function.imagefilledrectangle.html" >imagefilledrectangle</A > -- Draw a filled rectangle</DT ><DT ><A HREF="function.imagefilltoborder.html" >imagefilltoborder</A > -- Flood fill to specific color</DT ><DT ><A HREF="function.imagefilter.html" >imagefilter</A > -- Applies Filter an image using a custom angle </DT ><DT ><A HREF="function.imagefontheight.html" >imagefontheight</A > -- Get font height</DT ><DT ><A HREF="function.imagefontwidth.html" >imagefontwidth</A > -- Get font width</DT ><DT ><A HREF="function.imageftbbox.html" >imageftbbox</A > -- Give the bounding box of a text using fonts via freetype2</DT ><DT ><A HREF="function.imagefttext.html" >imagefttext</A > -- Write text to the image using fonts using FreeType 2</DT ><DT ><A HREF="function.imagegammacorrect.html" >imagegammacorrect</A > -- Apply a gamma correction to a GD image</DT ><DT ><A HREF="function.imagegd2.html" >imagegd2</A > -- Output GD2 image</DT ><DT ><A HREF="function.imagegd.html" >imagegd</A > -- Output GD image to browser or file</DT ><DT ><A HREF="function.imagegif.html" >imagegif</A > -- Output image to browser or file</DT ><DT ><A HREF="function.imageinterlace.html" >imageinterlace</A > -- Enable or disable interlace</DT ><DT ><A HREF="function.imageistruecolor.html" >imageistruecolor</A > -- Finds whether an image is a truecolor image.</DT ><DT ><A HREF="function.imagejpeg.html" >imagejpeg</A > -- Output image to browser or file</DT ><DT ><A HREF="function.imagelayereffect.html" >imagelayereffect</A > -- Set the alpha blending flag to use the bundled libgd layering effects </DT ><DT ><A HREF="function.imageline.html" >imageline</A > -- Draw a line</DT ><DT ><A HREF="function.imageloadfont.html" >imageloadfont</A > -- Load a new font</DT ><DT ><A HREF="function.imagepalettecopy.html" >imagepalettecopy</A > -- Copy the palette from one image to another</DT ><DT ><A HREF="function.imagepng.html" >imagepng</A > -- Output a PNG image to either the browser or a file</DT ><DT ><A HREF="function.imagepolygon.html" >imagepolygon</A > -- Draw a polygon</DT ><DT ><A HREF="function.imagepsbbox.html" >imagepsbbox</A > -- Give the bounding box of a text rectangle using PostScript Type1 fonts </DT ><DT ><A HREF="function.imagepscopyfont.html" >imagepscopyfont</A > -- Make a copy of an already loaded font for further modification </DT ><DT ><A HREF="function.imagepsencodefont.html" >imagepsencodefont</A > -- Change the character encoding vector of a font</DT ><DT ><A HREF="function.imagepsextendfont.html" >imagepsextendfont</A > -- Extend or condense a font</DT ><DT ><A HREF="function.imagepsfreefont.html" >imagepsfreefont</A > -- Free memory used by a PostScript Type 1 font</DT ><DT ><A HREF="function.imagepsloadfont.html" >imagepsloadfont</A > -- Load a PostScript Type 1 font from file</DT ><DT ><A HREF="function.imagepsslantfont.html" >imagepsslantfont</A > -- Slant a font</DT ><DT ><A HREF="function.imagepstext.html" >imagepstext</A > -- To draw a text string over an image using PostScript Type1 fonts</DT ><DT ><A HREF="function.imagerectangle.html" >imagerectangle</A > -- Draw a rectangle</DT ><DT ><A HREF="function.imagerotate.html" >imagerotate</A > -- Rotate an image with a given angle</DT ><DT ><A HREF="function.imagesavealpha.html" >imagesavealpha</A > -- Set the flag to save full alpha channel information (as opposed to single-color transparency) when saving PNG images. </DT ><DT ><A HREF="function.imagesetbrush.html" >imagesetbrush</A > -- Set the brush image for line drawing</DT ><DT ><A HREF="function.imagesetpixel.html" >imagesetpixel</A > -- Set a single pixel</DT ><DT ><A HREF="function.imagesetstyle.html" >imagesetstyle</A > -- Set the style for line drawing</DT ><DT ><A HREF="function.imagesetthickness.html" >imagesetthickness</A > -- Set the thickness for line drawing</DT ><DT ><A HREF="function.imagesettile.html" >imagesettile</A > -- Set the tile image for filling</DT ><DT ><A HREF="function.imagestring.html" >imagestring</A > -- Draw a string horizontally</DT ><DT ><A HREF="function.imagestringup.html" >imagestringup</A > -- Draw a string vertically</DT ><DT ><A HREF="function.imagesx.html" >imagesx</A > -- Get image width</DT ><DT ><A HREF="function.imagesy.html" >imagesy</A > -- Get image height</DT ><DT ><A HREF="function.imagetruecolortopalette.html" >imagetruecolortopalette</A > -- Convert a true color image to a palette image</DT ><DT ><A HREF="function.imagettfbbox.html" >imagettfbbox</A > -- Give the bounding box of a text using TrueType fonts</DT ><DT ><A HREF="function.imagettftext.html" >imagettftext</A > -- Write text to the image using TrueType fonts</DT ><DT ><A HREF="function.imagetypes.html" >imagetypes</A > -- Return the image types supported by this PHP build</DT ><DT ><A HREF="function.imagewbmp.html" >imagewbmp</A > -- Output image to browser or file</DT ><DT ><A HREF="function.imagexbm.html" >imagexbm</A > -- Output XBM image to browser or file </DT ><DT ><A HREF="function.iptcembed.html" >iptcembed</A > -- Embed binary IPTC data into a JPEG image</DT ><DT ><A HREF="function.iptcparse.html" >iptcparse</A > -- Parse a binary IPTC <A HREF="http://www.iptc.org/" TARGET="_top" >http://www.iptc.org/</A > block into single tags. </DT ><DT ><A HREF="function.jpeg2wbmp.html" >jpeg2wbmp</A > -- Convert JPEG image file to WBMP image file</DT ><DT ><A HREF="function.png2wbmp.html" >png2wbmp</A > -- Convert PNG image file to WBMP image file</DT ><DT ><A HREF="function.read-exif-data.html" >read_exif_data</A > -- Alias of <A HREF="function.exif-read-data.html" ><B CLASS="function" >exif_read_data()</B ></A ></DT ></DL ></DIV ></DIV ></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.ob-iconv-handler.html" ACCESSKEY="P" >Înapoi</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Acasã</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.exif-imagetype.html" ACCESSKEY="N" >Înainte</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >ob_iconv_handler</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Sus</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >exif_imagetype</TD ></TR ></TABLE ></DIV ></BODY ></HTML >