XXXIII. Image functions

You can use the image functions in PHP to get the size of JPEG, GIF, PNG, and SWF images, and if you have the GD library (available at http://www.boutell.com/gd/) you will also be able to create and manipulate images.

The format of images you are able to manipulate depend on the version of gd you install, and any other libraries gd might need to access those image formats. Versions of gd older than gd-1.6 support gif format images, and do not support png, where versions greater than gd-1.6 support png, not gif.

In order to read and write images in jpeg format, you will need to obtain and install jpeg-6b (available at ftp://ftp.uu.net/graphics/jpeg/), and then recompile gd to make use of jpeg-6b. You will also have to compile PHP with --with-jpeg-dir=/path/to/jpeg-6b.

To add support for Type 1 fonts, you can install t1lib (available at ftp://ftp.neuroinformatik.ruhr-uni-bochum.de/pub/software/t1lib/), and then add --with-t1lib[=dir].

Table of Contents
GetImageSize — Get the size of a GIF, JPEG, PNG or SWF image
ImageAlphaBlending — Set the blending mode for an image
ImageArc — Draw a partial ellipse
ImageFilledArc — Draw a partial ellipse and fill it
ImageEllipse — Draw an ellipse
ImageFilledEllipse — Draw a filled ellipse
ImageChar — Draw a character horizontally
ImageCharUp — Draw a character vertically
ImageColorAllocate — Allocate a color for an image
ImageColorDeAllocate — De-allocate a color for an image
ImageColorAt — Get the index of the color of a pixel
ImageColorClosest — Get the index of the closest color to the specified color
ImageColorClosestAlpha — Get the index of the closest color to the specified color + alpha
ImageColorExact — Get the index of the specified color
ImageColorExactAlpha — Get the index of the specified color + alpha
ImageColorResolve — Get the index of the specified color or its closest possible alternative
ImageColorResolveAlpha — Get the index of the specified color + alpha or its closest possible alternative
ImageGammaCorrect — Apply a gamma correction to a GD image
ImageColorSet — Set the color for the specified palette index
ImageColorsForIndex — Get the colors for an index
ImageColorsTotal — Find out the number of colors in an image's palette
ImageColorTransparent — Define a color as transparent
ImageCopy — Copy part of an image
ImageCopyMerge — Copy and merge part of an image
ImageCopyMergeGray — Copy and merge part of an image with gray scale
ImageCopyResized — Copy and resize part of an image
ImageCopyResampled — Copy and resize part of an image with resampling
ImageCreate — Create a new palette based image
ImageCreateTrueColor — Create a new true color image
ImageTrueColorToPalette — Convert a true color image to a palette image
ImageCreateFromGIF — Create a new image from file or URL
ImageCreateFromJPEG — Create a new image from file or URL
ImageCreateFromPNG — Create a new image from file or URL
ImageCreateFromWBMP — Create a new image from file or URL
ImageCreateFromString — Create a new image from the image stream in the string
ImageDashedLine — Draw a dashed line
ImageDestroy — Destroy an image
ImageFill — Flood fill
ImageFilledPolygon — Draw a filled polygon
ImageFilledRectangle — Draw a filled rectangle
ImageFillToBorder — Flood fill to specific color
ImageFontHeight — Get font height
ImageFontWidth — Get font width
ImageGIF — Output image to browser or file
ImagePNG — Output a PNG image to either the browser or a file
ImageJPEG — Output image to browser or file
ImageWBMP — Output image to browser or file
ImageInterlace — Enable or disable interlace
ImageLine — Draw a line
ImageLoadFont — Load a new font
ImagePolygon — Draw a polygon
ImagePSBBox — Give the bounding box of a text rectangle using PostScript Type1 fonts
ImagePSEncodeFont — Change the character encoding vector of a font
ImagePSFreeFont — Free memory used by a PostScript Type 1 font
ImagePSLoadFont — Load a PostScript Type 1 font from file
ImagePsExtendFont — Extend or condense a font
ImagePsSlantFont — Slant a font
ImagePSText — To draw a text string over an image using PostScript Type1 fonts
ImageRectangle — Draw a rectangle
ImageSetPixel — Set a single pixel
ImageSetBrush — Set the brush image for line drawing
ImageSetTile — Set the tile image for filling
ImageSetThickness — Set the thickness for line drawing
ImageString — Draw a string horizontally
ImageStringUp — Draw a string vertically
ImageSX — Get image width
ImageSY — Get image height
ImageTTFBBox — Give the bounding box of a text using TypeType fonts
ImageTTFText — Write text to the image using TrueType fonts
ImageTypes — Return the image types supported by this PHP build
read_exif_data — Read the EXIF headers from a JPEG