php-doc-en/features/images.sgml
James Gingerich 3dda08bb3d More reorganization. Big change here is breaking up the features section
into a number of smaller chapters, and chopping the "Language Reference"
part into a three parts ("Getting Started", "Language Reference", and
the badly-named "Features").


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@9855 c90b9560-bf6c-de11-be94-00142212c4b1
1999-06-20 01:21:17 +00:00

55 lines
1.6 KiB
Text

<chapter id="features.images">
<title>Creating GIF images</title>
<simpara>
PHP is not limited to creating just HTML output. It can also be
used to create GIF image files, or even more convenient GIF image
streams. You will need to compile PHP with the GD library of
image functions for this to work.
</simpara>
<para>
<example>
<title>GIF creation with PHP</title>
<programlisting role=php>
&lt;?php
Header("Content-type: image/gif");
$string=implode($argv," ");
$im = imagecreatefromgif("images/button1.gif");
$orange = ImageColorAllocate($im, 220, 210, 60);
$px = (imagesx($im)-7.5*strlen($string))/2;
ImageString($im,3,$px,9,$string,$orange);
ImageGif($im);
ImageDestroy($im);
?>
</programlisting>
</example>
This example would be called from a page with a tag like: &lt;img
src=&quot;button.php3?text&quot;&gt; The above button.php3 script
then takes this &quot;text&quot; string an overlays it on top of a
base image which in this case is &quot;images/button1.gif&quot;
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.
</para>
</chapter>
<!-- 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
sgml-parent-document:nil
sgml-default-dtd-file:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->