9.5. 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 distortions 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, ...

Get PHP 5 Power Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.