Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 703d980c580707c382b4e43e25965bc5 > files > 10882

php-manual-pt_BR-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>Imagens, Funções de</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Manual do PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Referência das Funções"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="iis_stop_service"
HREF="function.iis-stop-service.html"><LINK
REL="NEXT"
TITLE="gd_info"
HREF="function.gd-info.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></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 do PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.iis-stop-service.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.gd-info.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.image"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>LXV. Imagens, Funções de</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN81938"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="image.intro"
>Introdução</A
></H1
><P
>&#13;     O PHP não esta limitado a criar apenas saída em HTML. Ele também pode
     ser usado para criar e manipular arquivos de imagem em uma diversidade de 
     formatos, incluindo gif, png, jpg, wbmp, e xpm. E ainda mais convenietemente,
     o PHP pode enviar streams de saída de imagem diratamente para o browser. Você precisará
     compilar o PHP com a biblioteca GD de imagens de funções para
     isto funcionar. O PHP e GD também podem requerer outras bibliotecas, dependendo
     dos formatos de imagens com os quais você queira trabalhar.
    </P
><P
>&#13;     Você pode usar as funções de imagem no PHP para obter o tamanho de imagens 
     <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
>.
    </P
><P
>&#13;     <DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
       Leia a seção sobre requerimentos sobre como expandir as capacidades de imagem
       para ler, escrever e modificar imagens e para ler meta dados de fotos
       tiradas por cameras digitais.
      </P
></BLOCKQUOTE
></DIV
>
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="image.requirements"
>Dependências</A
></H1
><P
>&#13;     Se você tiver a biblioteca <ACRONYM
CLASS="acronym"
>GD</ACRONYM
> (disponível em <A
HREF="http://www.libgd.org/"
TARGET="_top"
>http://www.libgd.org/</A
>) você poderá também criar
     e manipular imagens.
    </P
><P
>&#13;     O formato das imagens que você pode manipilar dependem da versão da
     <ACRONYM
CLASS="acronym"
>GD</ACRONYM
> que você instalou, e de quaisquer outras bibliotecas que o 
     <ACRONYM
CLASS="acronym"
>GD</ACRONYM
> possa precisar para acessar estes formatos de imagens.
     Versões do <ACRONYM
CLASS="acronym"
>GD</ACRONYM
> anteriores a gd-1.6
     suportam imagens GIF, e não suportam PNG, enquanto versões  
     posteriores a gd-1.6 suportam PNG, não GIF.
      <DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
        Apartir do PHP 4.3 existe uma versão empacotada da biblioteca GD.
        Esta versão empacotada tem algumas melhorias como alpha blending,
        e deve ser usada em preferência da biblioteca externa, já
        que seu código-fonte é melhor mantido e mais estável.
       </P
></BLOCKQUOTE
></DIV
>
    </P
><P
>&#13;     Você pode querer melhorar o GD para manipular mais formatos de imagens.
     <DIV
CLASS="table"
><A
NAME="AEN81964"
></A
><P
><B
>Tabela 1. Formatos de imagens suportados</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><THEAD
><TR
><TH
>Formato da imagens</TH
><TH
>Biblioteca para baixar</TH
><TH
>Notas</TH
></TR
></THEAD
><TBODY
><TR
><TD
><TT
CLASS="literal"
>gif</TT
></TD
><TD
>&nbsp;</TD
><TD
>&#13;          Suportado apenas em versões do GD anteriores a gd-1.6. Suporte <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Apenas para leitura
          </I
></SPAN
> esta disponível com o PHP 4.3.0 e a biblioteca
          GD empacotada. Suporte para <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>Escrita</I
></SPAN
> esta disponível desde o
          PHP 4.3.9 e PHP 5.0.1. 
         </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>jpeg-6b</TT
></TD
><TD
><A
HREF="ftp://ftp.uu.net/graphics/jpeg/"
TARGET="_top"
>ftp://ftp.uu.net/graphics/jpeg/</A
></TD
><TD
>&nbsp;</TD
></TR
><TR
><TD
><TT
CLASS="literal"
>png</TT
></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
>&#13;          Apenas suportados em versões do GD maiores do que gd-1.6.
         </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>xpm</TT
></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
>&#13;          É provavel que você já tenha esta biblioteca disponível, se o seu sistema
          tiver um ambiênte X instalado.
         </TD
></TR
></TBODY
></TABLE
></DIV
>
    </P
><P
>&#13;     Voce pode querer melhorar o GD para lidar com fontes diferentes. As seguintes
     bibliotecas de fontes são suportadas:
     <DIV
CLASS="table"
><A
NAME="AEN81999"
></A
><P
><B
>Tabela 2. Bibliotes de fontes suportadas</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><THEAD
><TR
><TH
>Biblioteca de fonte</TH
><TH
>Download</TH
><TH
>Notas</TH
></TR
></THEAD
><TBODY
><TR
><TD
><TT
CLASS="literal"
>FreeType 1.x</TT
></TD
><TD
><A
HREF="http://www.freetype.org/"
TARGET="_top"
>http://www.freetype.org/</A
></TD
><TD
>&nbsp;</TD
></TR
><TR
><TD
><TT
CLASS="literal"
>FreeType 2</TT
></TD
><TD
><A
HREF="http://www.freetype.org/"
TARGET="_top"
>http://www.freetype.org/</A
></TD
><TD
>&nbsp;</TD
></TR
><TR
><TD
><TT
CLASS="literal"
>T1lib</TT
></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
>&#13;          Suporte para fontes Type 1.
         </TD
></TR
></TBODY
></TABLE
></DIV
>
    </P
><P
>&#13;     Se você tiver o PHP compilado com <CODE
CLASS="option"
>--enable-exif</CODE
>
     você poderá trabalhar com as informações guardadas nos cabeçalhos de imagens
     <ACRONYM
CLASS="acronym"
>JPEG</ACRONYM
> e <ACRONYM
CLASS="acronym"
>TIFF</ACRONYM
>. Deste jeito você poderá
     ler meta dados gerados por cameras digitais como mencionado acia. Estas
     funções não precisam da biblioteca <ACRONYM
CLASS="acronym"
>GD</ACRONYM
>.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="image.installation"
>Instalação</A
></H1
><P
>  
  Para ativar suporte ao GD, configure o PHP com
  <CODE
CLASS="option"
>--with-gd[=DIR]</CODE
>, aonde DIR é o
  diretório de instalação. Para usar a versão recomendada da biblioteca GD que acompanha o PHP
  (a qual foi embutida pela primeira vez no PHP 4.3.0), use a opção de configuração 
  <CODE
CLASS="option"
>--with-gd</CODE
>. 
 </P
><P
>&#13;   No Windows, você irá incluir a DLL do GD2 <TT
CLASS="filename"
>php_gd2.dll</TT
> como
   uma extensão no <TT
CLASS="filename"
>php.ini</TT
>. A DLL GD1 <TT
CLASS="filename"
>php_gd.dll</TT
> foi 
   removida a partir do PHP 4.3.2. Também note que as funções de imagens truecolor,
   como <A
HREF="function.imagecreatetruecolor.html"
><B
CLASS="function"
>imagecreatetruecolor()</B
></A
>, requerem GD2.
 </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
   Para ativar o suporte a exif no Windows, php_mbstring.dll deve ser carregada antes
   de php_exif.dll no php.ini.
  </P
></BLOCKQUOTE
></DIV
><P
>&#13;  Para desabilitar o suporte ao GD no <SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>PHP 3</I
></SPAN
> adicione
  <CODE
CLASS="option"
>--without-gd</CODE
> na sua linha de configuração.
 </P
><P
>&#13;  Melhore as capacidades do GD para manipular mais formatos de imagens especificando
  a opção <TT
CLASS="literal"
>--with-XXXX</TT
> na sua
  linha de configuração do PHP.
  <DIV
CLASS="table"
><A
NAME="AEN82048"
></A
><P
><B
>Tabela 3. Formatos de imagens suportados</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><THEAD
><TR
><TH
>Formato de Imagem</TH
><TH
>Opção de Configuração</TH
></TR
></THEAD
><TBODY
><TR
><TD
><TT
CLASS="literal"
>jpeg-6b</TT
></TD
><TD
>&#13;       Para ativar suporte a jpeg-6b adicione
       <CODE
CLASS="option"
>--with-jpeg-dir=DIR</CODE
>.
      </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>png</TT
></TD
><TD
>&#13;       Para ativar suporte para png adicione
       <CODE
CLASS="option"
>--with-png-dir=DIR</CODE
>. Note que, libpng
       precisa de <A
HREF="ref.zlib.html#zlib.requirements"
>zlib library</A
>,
       portanto adicione a opção <CODE
CLASS="option"
>--with-zlib-dir[=DIR]</CODE
>
       na sua linha de configuração.
      </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>xpm</TT
></TD
><TD
>&#13;       Para ativar suporte a xpm adicione
       <CODE
CLASS="option"
>--with-xpm-dir=DIR</CODE
>. Se o configure
       não for capaz de encontrar as bibliotecas necessárias, você deverá adicionar
       o caminho até as suas bibliotecas X11.
      </TD
></TR
></TBODY
></TABLE
></DIV
>
 </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>Nota: </B
>
    Ao compilar o PHP com a  libpng, você deve usar a mesma versão que foi
    ligada com a biblioteca GD.
   </P
></BLOCKQUOTE
></DIV
><P
>&#13;  Melhore as capacidades do GD para lidar com fontes diferentes especificando
  a opção de configuração <TT
CLASS="literal"
>--with-XXXX</TT
> na linha de 
  configuração do PHP.
  <DIV
CLASS="table"
><A
NAME="AEN82077"
></A
><P
><B
>Tabela 4. Bibliotecas de Fontes Suportadas</B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><THEAD
><TR
><TH
>Biblioteca de Fonte</TH
><TH
>Opção de Configuração</TH
></TR
></THEAD
><TBODY
><TR
><TD
><TT
CLASS="literal"
>FreeType 1.x</TT
></TD
><TD
>&#13;       Para ativar suporte a FreeType 1.x adicione
       <CODE
CLASS="option"
>--with-ttf[=DIR]</CODE
>.
      </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>FreeType 2</TT
></TD
><TD
>&#13;       Para ativar suporte a FreeType 2 adicione
       <CODE
CLASS="option"
>--with-freetype-dir=DIR</CODE
>.
      </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>T1lib</TT
></TD
><TD
>&#13;       Para ativar suporte a T1lib (Type 1 fonts) adicione
       <CODE
CLASS="option"
>--with-t1lib[=DIR]</CODE
>.
      </TD
></TR
><TR
><TD
><TT
CLASS="literal"
>Native TrueType string function</TT
></TD
><TD
>&#13;       Para ativar suporte a native TrueType string function adicione
       <CODE
CLASS="option"
>--enable-gd-native-ttf</CODE
>.
      </TD
></TR
></TBODY
></TABLE
></DIV
>
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="image.configuration"
>Configurações em execução</A
></H1
><P
>&#13;  Não existem configurações especificas para imagens, mas você pode estar interresado nas
  diretivas da <A
HREF="ref.exif.html"
>extensão exif</A
>.
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="image.resources"
>Tipos Resource</A
></H1
><P
>Esta extensão não possui nenhum tipo resource.</P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="image.constants"
>Constantes pré-definidas</A
></H1
><P
>&#13;As contantes abaixo são definidas por esta extensão e somente
 estarão disponíveis quando a extensão foi compilada com o PHP
 ou carregada dinamicamente durante a execução.
</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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;    
    </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
>&#13;    
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </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
>&#13;     
    </P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="image.examples"
>Exemplos</A
></H1
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN82311"
></A
><P
><B
>Exemplo 1. Criação de PNG com o PHP</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />&nbsp;&nbsp;&nbsp;&nbsp;header</font><font color="#007700">(</font><font color="#DD0000">"Content-type: image/png"</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$im&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">$px&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</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 />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">imagepng</font><font color="#007700">(</font><font color="#0000BB">$im</font><font color="#007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#0000BB">imagedestroy</font><font color="#007700">(</font><font color="#0000BB">$im</font><font color="#007700">);<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
     Este exemplo deve ser usado em uma página com uma tag como esta: &#60;img
     src="button.php?text=text"&#62;. O script button.php acima
     pega a string "text" e coloca-a no topo de uma imagem base 
     que neste caso é "images/button1.png"
     e mostra a imagem resultante. Este é um meio conveniente de 
     evitar desenhar uma nova imagem de botão a cada vez que
     você quiser modificar o texto do botão. Com este metodo
     ele é dinamicamente gerado.
    </P
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Índice</B
></DT
><DT
><A
HREF="function.gd-info.html"
>gd_info</A
>&nbsp;--&nbsp;Obtém informações sobre a biblioteca GD instalada atualmente</DT
><DT
><A
HREF="function.getimagesize.html"
>getimagesize</A
>&nbsp;--&nbsp;Obtém o tamanho de uma imagem</DT
><DT
><A
HREF="function.image-type-to-extension.html"
>image_type_to_extension</A
>&nbsp;--&nbsp;Get file extension for image type</DT
><DT
><A
HREF="function.image-type-to-mime-type.html"
>image_type_to_mime_type</A
>&nbsp;--&nbsp;Obtém o Mime-Type para um tipo de imagem retornado por getimagesize, 
    exif_read_data, exif_thumbnail, exif_imagetype</DT
><DT
><A
HREF="function.image2wbmp.html"
>image2wbmp</A
>&nbsp;--&nbsp;Envia uma imagem para o browser ou arquivo</DT
><DT
><A
HREF="function.imagealphablending.html"
>imagealphablending</A
>&nbsp;--&nbsp;Set the blending mode for an image</DT
><DT
><A
HREF="function.imageantialias.html"
>imageantialias</A
>&nbsp;--&nbsp;
    Indica se as funções de antialias devem ser usadas ou não
   </DT
><DT
><A
HREF="function.imagearc.html"
>imagearc</A
>&nbsp;--&nbsp;Desenha um elipse parcial</DT
><DT
><A
HREF="function.imagechar.html"
>imagechar</A
>&nbsp;--&nbsp;Desenha um caractere horizontalmente</DT
><DT
><A
HREF="function.imagecharup.html"
>imagecharup</A
>&nbsp;--&nbsp;Desenha um caractere verticalmente</DT
><DT
><A
HREF="function.imagecolorallocate.html"
>imagecolorallocate</A
>&nbsp;--&nbsp;Aloca uma cor para uma imagem</DT
><DT
><A
HREF="function.imagecolorallocatealpha.html"
>imagecolorallocatealpha</A
>&nbsp;--&nbsp;Aloca cor para uma imagem</DT
><DT
><A
HREF="function.imagecolorat.html"
>imagecolorat</A
>&nbsp;--&nbsp;Retorna o índice da cor de um pixel</DT
><DT
><A
HREF="function.imagecolorclosest.html"
>imagecolorclosest</A
>&nbsp;--&nbsp;Retorna o índice da cor mais próxima da cor especificada</DT
><DT
><A
HREF="function.imagecolorclosestalpha.html"
>imagecolorclosestalpha</A
>&nbsp;--&nbsp;Retorna o índice da cor mais próxima da cor especificada + transparencia</DT
><DT
><A
HREF="function.imagecolorclosesthwb.html"
>imagecolorclosesthwb</A
>&nbsp;--&nbsp;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
>&nbsp;--&nbsp;Desaloca uma cor para uma imagem</DT
><DT
><A
HREF="function.imagecolorexact.html"
>imagecolorexact</A
>&nbsp;--&nbsp;Retorna o índice da cor especificada</DT
><DT
><A
HREF="function.imagecolorexactalpha.html"
>imagecolorexactalpha</A
>&nbsp;--&nbsp;Retorna o índice da cor especificada + transparencia</DT
><DT
><A
HREF="function.imagecolormatch.html"
>imagecolormatch</A
>&nbsp;--&nbsp;
    Faz com que a versão das cores da paleta sejam mais próximas
    da versão truecolor
   </DT
><DT
><A
HREF="function.imagecolorresolve.html"
>imagecolorresolve</A
>&nbsp;--&nbsp;
    Retorna o índice da cor especificada ou
    a alternativa mais próxima possível
   </DT
><DT
><A
HREF="function.imagecolorresolvealpha.html"
>imagecolorresolvealpha</A
>&nbsp;--&nbsp;
    Retorna o índice da cor especificada + transparência ou a sua
    alternativa mais próxima
   </DT
><DT
><A
HREF="function.imagecolorset.html"
>imagecolorset</A
>&nbsp;--&nbsp;Set the color for the specified palette index</DT
><DT
><A
HREF="function.imagecolorsforindex.html"
>imagecolorsforindex</A
>&nbsp;--&nbsp;Retorna as cores de um índice</DT
><DT
><A
HREF="function.imagecolorstotal.html"
>imagecolorstotal</A
>&nbsp;--&nbsp;Retorna o número de cores na paleta de uma imagem</DT
><DT
><A
HREF="function.imagecolortransparent.html"
>imagecolortransparent</A
>&nbsp;--&nbsp;Define uma cor como tansparente</DT
><DT
><A
HREF="function.imageconvolution.html"
>imageconvolution</A
>&nbsp;--&nbsp;Apply a 3x3 convolution matrix, using coefficient and offset</DT
><DT
><A
HREF="function.imagecopy.html"
>imagecopy</A
>&nbsp;--&nbsp;Copia parte de uma imagem</DT
><DT
><A
HREF="function.imagecopymerge.html"
>imagecopymerge</A
>&nbsp;--&nbsp;Copia e combina uma parte de uma imagem</DT
><DT
><A
HREF="function.imagecopymergegray.html"
>imagecopymergegray</A
>&nbsp;--&nbsp;Copy and merge part of an image with gray scale</DT
><DT
><A
HREF="function.imagecopyresampled.html"
>imagecopyresampled</A
>&nbsp;--&nbsp;Copy and resize part of an image with resampling</DT
><DT
><A
HREF="function.imagecopyresized.html"
>imagecopyresized</A
>&nbsp;--&nbsp;Copy and resize part of an image</DT
><DT
><A
HREF="function.imagecreate.html"
>imagecreate</A
>&nbsp;--&nbsp;Cria uma nova imagem baseada em paleta</DT
><DT
><A
HREF="function.imagecreatefromgd2.html"
>imagecreatefromgd2</A
>&nbsp;--&nbsp;Cria uma nova imagem apartir de um arquivo GD2 ou URL</DT
><DT
><A
HREF="function.imagecreatefromgd2part.html"
>imagecreatefromgd2part</A
>&nbsp;--&nbsp;Cria uma nova imagem apartir de uma parte de um arquivo GD ou URL</DT
><DT
><A
HREF="function.imagecreatefromgd.html"
>imagecreatefromgd</A
>&nbsp;--&nbsp;Cria uma nova imagem apartir de um arquivo GD ou URL</DT
><DT
><A
HREF="function.imagecreatefromgif.html"
>imagecreatefromgif</A
>&nbsp;--&nbsp;Cria uma nova imagem a partir de um arquivo ou URL</DT
><DT
><A
HREF="function.imagecreatefromjpeg.html"
>imagecreatefromjpeg</A
>&nbsp;--&nbsp;Cria uma nova imagem a apratir de um arquivo ou URL</DT
><DT
><A
HREF="function.imagecreatefrompng.html"
>imagecreatefrompng</A
>&nbsp;--&nbsp;Cria uma nova imagem a apratir de um arquivo ou URL</DT
><DT
><A
HREF="function.imagecreatefromstring.html"
>imagecreatefromstring</A
>&nbsp;--&nbsp;Cria uma nova imagem a apartir da imagem na string</DT
><DT
><A
HREF="function.imagecreatefromwbmp.html"
>imagecreatefromwbmp</A
>&nbsp;--&nbsp;Cria uma nova imagem a apratir de um arquivo ou URL</DT
><DT
><A
HREF="function.imagecreatefromxbm.html"
>imagecreatefromxbm</A
>&nbsp;--&nbsp;Cria uma nova imagem a apratir de um arquivo ou URL</DT
><DT
><A
HREF="function.imagecreatefromxpm.html"
>imagecreatefromxpm</A
>&nbsp;--&nbsp;Cria uma nova imagem a apratir de um arquivo ou URL</DT
><DT
><A
HREF="function.imagecreatetruecolor.html"
>imagecreatetruecolor</A
>&nbsp;--&nbsp;Cria uma nova imagem true color</DT
><DT
><A
HREF="function.imagedashedline.html"
>imagedashedline</A
>&nbsp;--&nbsp;Desenha uma linha pontilhada</DT
><DT
><A
HREF="function.imagedestroy.html"
>imagedestroy</A
>&nbsp;--&nbsp;Destroi uma imagem</DT
><DT
><A
HREF="function.imageellipse.html"
>imageellipse</A
>&nbsp;--&nbsp;Desenha um elipse</DT
><DT
><A
HREF="function.imagefill.html"
>imagefill</A
>&nbsp;--&nbsp;Flood fill</DT
><DT
><A
HREF="function.imagefilledarc.html"
>imagefilledarc</A
>&nbsp;--&nbsp;Draw a partial ellipse and fill it</DT
><DT
><A
HREF="function.imagefilledellipse.html"
>imagefilledellipse</A
>&nbsp;--&nbsp;Desenha um elipse prenchido</DT
><DT
><A
HREF="function.imagefilledpolygon.html"
>imagefilledpolygon</A
>&nbsp;--&nbsp;Desenha um poligono prenchido</DT
><DT
><A
HREF="function.imagefilledrectangle.html"
>imagefilledrectangle</A
>&nbsp;--&nbsp;Desenha um retângulo prenchido</DT
><DT
><A
HREF="function.imagefilltoborder.html"
>imagefilltoborder</A
>&nbsp;--&nbsp;Flood fill to specific color</DT
><DT
><A
HREF="function.imagefilter.html"
>imagefilter</A
>&nbsp;--&nbsp;Applies a filter to an image</DT
><DT
><A
HREF="function.imagefontheight.html"
>imagefontheight</A
>&nbsp;--&nbsp;Retorna a altura da fonte</DT
><DT
><A
HREF="function.imagefontwidth.html"
>imagefontwidth</A
>&nbsp;--&nbsp;Retorna a largura da fonte</DT
><DT
><A
HREF="function.imageftbbox.html"
>imageftbbox</A
>&nbsp;--&nbsp;Give the bounding box of a text using fonts via freetype2</DT
><DT
><A
HREF="function.imagefttext.html"
>imagefttext</A
>&nbsp;--&nbsp;Escreve texto na imagem usando fontes FreeType 2</DT
><DT
><A
HREF="function.imagegammacorrect.html"
>imagegammacorrect</A
>&nbsp;--&nbsp;Apply a gamma correction to a GD image</DT
><DT
><A
HREF="function.imagegd2.html"
>imagegd2</A
>&nbsp;--&nbsp;Envia uma imagem GD2</DT
><DT
><A
HREF="function.imagegd.html"
>imagegd</A
>&nbsp;--&nbsp;Envia a imagem GD para o browser ou um arquivo</DT
><DT
><A
HREF="function.imagegif.html"
>imagegif</A
>&nbsp;--&nbsp;Envia uma imagem para o browser ou arquivo</DT
><DT
><A
HREF="function.imageinterlace.html"
>imageinterlace</A
>&nbsp;--&nbsp;Ativa ou desativa o entrelaçamento</DT
><DT
><A
HREF="function.imageistruecolor.html"
>imageistruecolor</A
>&nbsp;--&nbsp;Indica quando uma imagem é uma imagem truecolor</DT
><DT
><A
HREF="function.imagejpeg.html"
>imagejpeg</A
>&nbsp;--&nbsp;Envia a imagem para o borwser ou arquivo</DT
><DT
><A
HREF="function.imagelayereffect.html"
>imagelayereffect</A
>&nbsp;--&nbsp;Set the alpha blending flag to use the bundled libgd layering effects</DT
><DT
><A
HREF="function.imageline.html"
>imageline</A
>&nbsp;--&nbsp;Desenha uma linha</DT
><DT
><A
HREF="function.imageloadfont.html"
>imageloadfont</A
>&nbsp;--&nbsp;Carrega uma nova fonte</DT
><DT
><A
HREF="function.imagepalettecopy.html"
>imagepalettecopy</A
>&nbsp;--&nbsp;Copia a paleta de uma imagem para a outra</DT
><DT
><A
HREF="function.imagepng.html"
>imagepng</A
>&nbsp;--&nbsp;Envia uma imagem PNG para o browser ou para um arquivo</DT
><DT
><A
HREF="function.imagepolygon.html"
>imagepolygon</A
>&nbsp;--&nbsp;Desenha um poligono</DT
><DT
><A
HREF="function.imagepsbbox.html"
>imagepsbbox</A
>&nbsp;--&nbsp;Give the bounding box of a text rectangle using PostScript Type1 fonts</DT
><DT
><A
HREF="function.imagepsencodefont.html"
>imagepsencodefont</A
>&nbsp;--&nbsp;Change the character encoding vector of a font</DT
><DT
><A
HREF="function.imagepsextendfont.html"
>imagepsextendfont</A
>&nbsp;--&nbsp;Extend or condense a font</DT
><DT
><A
HREF="function.imagepsfreefont.html"
>imagepsfreefont</A
>&nbsp;--&nbsp;Libera a memória usada por uma fonte PostScript Type</DT
><DT
><A
HREF="function.imagepsloadfont.html"
>imagepsloadfont</A
>&nbsp;--&nbsp;Carrega uma fonte PostScript Type 1 a partir de um arquivo</DT
><DT
><A
HREF="function.imagepsslantfont.html"
>imagepsslantfont</A
>&nbsp;--&nbsp;Slant a font</DT
><DT
><A
HREF="function.imagepstext.html"
>imagepstext</A
>&nbsp;--&nbsp;Draws a text over an image using PostScript Type1 fonts</DT
><DT
><A
HREF="function.imagerectangle.html"
>imagerectangle</A
>&nbsp;--&nbsp;Desenha um retângulo</DT
><DT
><A
HREF="function.imagerotate.html"
>imagerotate</A
>&nbsp;--&nbsp;Gira uma imagem com o ângulo dado</DT
><DT
><A
HREF="function.imagesavealpha.html"
>imagesavealpha</A
>&nbsp;--&nbsp;
    Define a opção para salvar a informação completa do alpha channel (ao invés
    de a transparencia de uma cor só) quando estiver salvando imagens PNG.
   </DT
><DT
><A
HREF="function.imagesetbrush.html"
>imagesetbrush</A
>&nbsp;--&nbsp;Set the brush image for line drawing</DT
><DT
><A
HREF="function.imagesetpixel.html"
>imagesetpixel</A
>&nbsp;--&nbsp;Define um único pixel</DT
><DT
><A
HREF="function.imagesetstyle.html"
>imagesetstyle</A
>&nbsp;--&nbsp;Set the style for line drawing</DT
><DT
><A
HREF="function.imagesetthickness.html"
>imagesetthickness</A
>&nbsp;--&nbsp;Define a espessura para o desenho de linhas</DT
><DT
><A
HREF="function.imagesettile.html"
>imagesettile</A
>&nbsp;--&nbsp;Set the tile image for filling</DT
><DT
><A
HREF="function.imagestring.html"
>imagestring</A
>&nbsp;--&nbsp;Desenha uma string horizontalmente</DT
><DT
><A
HREF="function.imagestringup.html"
>imagestringup</A
>&nbsp;--&nbsp;Desenha uma string verticalmente</DT
><DT
><A
HREF="function.imagesx.html"
>imagesx</A
>&nbsp;--&nbsp;Obtem a largura da imagem</DT
><DT
><A
HREF="function.imagesy.html"
>imagesy</A
>&nbsp;--&nbsp;Obtém a altura da imagem</DT
><DT
><A
HREF="function.imagetruecolortopalette.html"
>imagetruecolortopalette</A
>&nbsp;--&nbsp;Converte uma imagem true color para uma imagem de paleta</DT
><DT
><A
HREF="function.imagettfbbox.html"
>imagettfbbox</A
>&nbsp;--&nbsp;Retorna uma caixa com o limites de um texto usando fontes TrueType</DT
><DT
><A
HREF="function.imagettftext.html"
>imagettftext</A
>&nbsp;--&nbsp;Escreve texto na imagem usando fontes TrueType</DT
><DT
><A
HREF="function.imagetypes.html"
>imagetypes</A
>&nbsp;--&nbsp;Retorna os tipos de imagens suportados por esta instalação do PHP</DT
><DT
><A
HREF="function.imagewbmp.html"
>imagewbmp</A
>&nbsp;--&nbsp;Envia uma imagem para o browser ou arquivo</DT
><DT
><A
HREF="function.imagexbm.html"
>imagexbm</A
>&nbsp;--&nbsp;Output XBM image to browser or file</DT
><DT
><A
HREF="function.iptcembed.html"
>iptcembed</A
>&nbsp;--&nbsp;Embute dados binários IPTC em uma imagem JPEG</DT
><DT
><A
HREF="function.iptcparse.html"
>iptcparse</A
>&nbsp;--&nbsp;
     Interpreta um bloco IPTC <A
HREF="http://www.iptc.org/"
TARGET="_top"
>http://www.iptc.org/</A
>
     binário em tags simples.
    </DT
><DT
><A
HREF="function.jpeg2wbmp.html"
>jpeg2wbmp</A
>&nbsp;--&nbsp;Converte um arquivo de imagem JPEG para um arquivo de imagem WBMP</DT
><DT
><A
HREF="function.png2wbmp.html"
>png2wbmp</A
>&nbsp;--&nbsp;Converte um arquivo de imagem PNG para um arquivo de imagem WBMP</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.iis-stop-service.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Principal</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.gd-info.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>iis_stop_service</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>Acima</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>gd_info</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>