RTFM & YMMV

 

The PHP Image functions read, manipulate, and output image streams by accessing functions provided by the external GD library (http://www.boutell.com/gd/), which in turn, requires a variety of other libraries to support a number of image formats & font systems.

Since PHP 4.3 the GD library is bundled and installed by default.

In previous versions, to enable GD-support configure PHP --with-gd[=DIR], where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option --with-gd. In Windows, you'll include the GD2 DLL PHP_gd2.dll as an extension in PHP.ini.

You can find a good, detailed guide to compiling and enabling GD in PHP by Marco Tabini in the OnLamp.com PHP DevCenter.

 

array gd_info  ( void )
Returns an associative array describing the version and capabilities of the installed GD library.
<?PHP print_r(gd_info()); ?>

Array
(
    [GD Version] => bundled (2.0.28 compatible)
    [FreeType Support] => 1
    [FreeType Linkage] => with freetype
    [T1Lib Support] => 
    [GIF Read Support] => 1
    [GIF Create Support] => 1
    [JPG Support] => 1
    [PNG Support] => 1
    [WBMP Support] => 1
    [XPM Support] => 
    [XBM Support] => 1
    [JIS-mapped Japanese Font Support] => 
)
int imageTypes  ( void )
Returns a bit-field corresponding to the image formats supported by the version of GD linked into PHP. The following bits are returned:
IMG_GIF | IMG_JPG | IMG_PNG | IMG_WBMP.
<?PHP
if (imagetypes() & IMG_GIF) echo "GIF Support is enabled<br />";
if (
imagetypes() & IMG_JPG) echo "JPEG Support is enabled<br />";
if (
imagetypes() & IMG_PNG) echo "PNG Support is enabled<br />";
if (
imagetypes() & IMG_WBMP) echo "WBMP Support is enabled<br />";
?>

GIF Support is enabled
JPEG Support is enabled
PNG Support is enabled
WBMP Support is enabled