Current versions of the PHP distribution include a bundled version of Thomas Boutell's GD graphics library. The inclusion of this library eliminates the need to download and install several third-party libraries, but this library needs to be activated at installation time.
By the Way
If you cannot install PHP as directed in Chapter 4, "Installing and Configuring PHP," and are stuck with a version of PHP earlier than 4.3.0, you will have to go to http://www.boutell.com/gd/ and download the source of the GD library. Follow the instructions included with that software and consult its manual for difficulties with installation.
To enable the use of the GD library at installation time, Linux/UNIX users must add the following to the configure parameters when preparing to build PHP:
By the Way
If you download your own version of GD, you must specify the path, as in --with-gd=/path/to/gd.
After running the PHP configure program again, you must go through the make and make install process as you did in Chapter 4. Windows users who want to enable GD simply have to activate php_gd2.dll as an extension in the php.ini file, as you learned in Chapter 4.
When using the GD library, you are limited to working with files in GIF format unless you install additional libraries.
Obtaining Additional Libraries
Working with GIF files might suit your needs perfectly, but if you want to create JPEG or PNG files, you will need to download and install a few libraries and make some modifications to your PHP installation.
Follow the instructions at these sites to install the libraries. After installation, Linux/UNIX users must again reconfigure and rebuild PHP by first adding the following to the PHP configure parameters (assuming that you want to use all three, if not, just add the applicable ones):
--with-jpeg-dir=[path to jpeg directory] --with-png-dir=[path to PNG directory] --with-zlib=[path to zlib directory]
After running the PHP configure program again, you need to go through the make and make install process as you did in Chapter 4. Your libraries should then be activated and ready for use.