CHAPTER 9 – GRAPHICS MANIPULATION WITH GD
Instead of describing all the GD functions that PHP supports, we discuss two common uses of the GD image library. In the first example, we use the GD libraries to build an image with a code word on it. We also add some distor- tions so that the image is machine-unreadable--the perfect protection against automatic tools that fill in forms. In the second example, we create a bar chart, including axis, labels, background, TrueType text, and alpha blending. Our examples require the bundled GD library. For UNIX OSs, you need to compile PHP using the option --with-gd (without path). For Windows, you can use the packaged php_gd2.dll and enable it in php.ini. Because we make use of some additional functions of the GD library, you need to see the infor- mation, shown in Figure 9.5, in the GD section of your phpinfo() output (except for WBMP and XPM support).
Fig. 9.5 GD phpinfo() output. A typical set of configuration options would be --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-freetype-dir=/usr