Specifications

GIF
GIF stands for Graphics Interchange Format. It is a compressed lossless format widely used on
the Web for storing images containing text, straight lines, and blocks of single color.
The question you are likely asking is, why doesnt gd support GIFs?
The answer is that it used to, up to version 1.3. If you want to install and use the GIF functions
instead of the PNG functions, you can download gd version 1.3 from
http://www.linuxguruz.org/downloads/gd1.3.tar.gz
Note, however, that the makers of gd discourage you from using this version and no longer
support it. This copy of the GIF version might not be available forever.
There is a good reason that gd no longer supports GIFs. Standard GIFs use a form of compres-
sion known as LZW (Lempel Ziv Welch), which is subject to a patent owned by UNISYS.
Providers of programs that read and write GIFs must pay licensing fees to UNISYS. For exam-
ple, Adobe has paid a licensing fee for products such as Photoshop that are used to create
GIFs. Code libraries appear to be in the situation in which the writers of the code library must
pay a fee, and, in addition, the users of the library must also pay a fee. Thus, if you use a GIF
version of the GD library on your Web site, you might owe UNISYS some fairly hefty licens-
ing fees.
This situation is unfortunate because GIFs were in use for many years before UNISYS chose
to enforce licensing. Thus, the format became one of the standards for the Web. A lot of ill
feeling exists about the patent in the Web development community. You can read about this
(and form your own opinion) at UNISYSs site
http://www.unisys.com/unisys/lzw/
and at Burn All Gifs, their opposition,
http://burnallgifs.org/
We are not lawyers, and none of this should be interpreted as legal advice, but we think it is
easier to use PNGs, regardless of the politics.
Browser support for PNGs is improving; however, the LZW patent expires on June 19, 2003,
so the final outcome is yet to be seen.
Creating Images
The four basic steps to creating an image in PHP are as follows:
1. Creating a canvas image on which to work
2. Drawing shapes or printing text on that canvas
Advanced PHP Techniques
P
ART IV
404
24 7842 CH19 3/6/01 3:42 PM Page 404