File: images.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (61 lines) | stat: -rw-r--r-- 2,011 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="big5"?>
 <chapter id="features.images">
  <title>Creating and manipulating images</title>

  <simpara>
   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. GD stopped supporting 
   Gif images in version 1.6.
  </simpara>

  <para>
   <example>
    <title>PNG creation with PHP</title>
    <programlisting role="php">
&lt;?php
    Header("Content-type: image/png");
    $string=implode($argv," ");
    $im = imageCreateFromPng("images/button1.png");
    $orange = ImageColorAllocate($im, 220, 210, 60);
    $px = (imagesx($im)-7.5*strlen($string))/2;
    ImageString($im,3,$px,9,$string,$orange);
    ImagePng($im);
    ImageDestroy($im);
?>
    </programlisting>
   </example>

   This example would be called from a page with a tag like: &lt;img
   src=&quot;button.php?text&quot;&gt; The above button.php 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.png&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
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:
-->