Table of Contents
Requirements
Installation and Configuration
Resources and Constants
This chapter talks about requirements, installation, and configuration
as well as resources and constants related to GD library setup.
Requirements
The first thing you need to use GD Functions is the GD library. Since
PHP 4.3 there is a bundled version of this library. You can use the
external version from www.libgd.org [http://www.libgd.org/] as well,
but bundled one should be preffered because it has some additional
features like alpha blending. Also its codebase is better maintained
and more stable. [2][http://pterodactyl.l2p.net/book/php5image/page/
bi01.html#php_manual]
To enhance GD to handle more image formats and/or to deal with
different fonts you can use the following libraries.
* jpeg-6b [ftp://ftp.uu.net/graphics/jpeg/]
* png [http://www.libpng.org/pub/png/libpng.html]
* xpm [ftp://metalab.unc.edu/pub/Linux/libs/X/!INDEX.html]
* FreeType 1.x and 2 [http://www.freetype.org/]
* T1lib [ftp://sunsite.unc.edu/pub/Linux/libs/graphics/]
Installation and Configuration
To enable GD support configure PHP --with-gd (or - if you use the
external library - --with-gd=DIR, where DIR is the GD base install
directory).
[Important][http://pterodactyl.l2p.net/images/docbook/important.png]
Important
GD library requires libpng and libjpeg to compile.
Include the GD2 DLL php_gd2.dll as an extension in php.ini in Windows.
You can enhance the capabilities of GD to handle more image formats
and/or to deal with different fonts by specifying some extra configure
switches (in some cases the DIR parameter is optional).
* To enable support for jpeg-6b: --with-jpeg-dir=DIR.
* To enable support for png (note, libpng requires the zlib
library): --with-png-dir=DIR and --with-zlib-dir=DIR.
* To enable support for xpm: --with-xpm-dir=DIR.
* To enable support for FreeType 1: --with-ttf=DIR.
* To enable support for FreeType 2: -with-freetype-dir=DIR.
* To enable support for T1lib: --with-t1lib=DIR.
* To enable support for native TrueType string function: --
enable-gd-native-ttf.
There are no image specific configurations.
[Important][http://pterodactyl.l2p.net/images/docbook/important.png]
Important
Image functions are very memory intensive, so be sure to set
memory_limit high enough.
Resources and Constants
Resource Types
* image identifier
* font identifier
Also the constants below are defined by GD extension. All constants
are integers.
IMG_GIF IMG_COLOR_TRANSPARENT IMAGETYPE_PSD IMAGETYPE_JPX
IMG_JPG IMG_ARC_ROUNDED IMAGETYPE_BMP IMAGETYPE_SWC
IMG_JPEG IMG_ARC_PIE IMAGETYPE_WBMP PNG_NO_FILTER
IMG_PNG IMG_ARC_CHORD IMAGETYPE_XBM PNG_FILTER_NONE
IMG_WBMP IMG_ARC_NOFILL IMAGETYPE_TIFF_II PNG_FILTER_SUB
IMG_XPM IMG_ARC_EDGED IMAGETYPE_TIFF_MM PNG_FILTER_UP
IMG_COLOR_TILED IMAGETYPE_GIF IMAGETYPE_IFF PNG_FILTER_AVG
IMG_COLOR_STYLED IMAGETYPE_JPEG IMAGETYPE_JB2 PNG_FILTER_PAETH
IMG_COLOR_BRUSHED IMAGETYPE_PNG IMAGETYPE_JPC PNG_ALL_FILTERS
IMG_COLOR_STYLEDBRUSHED IMAGETYPE_SWF IMAGETYPE_JP2