Easy Tutorial
❮ Func Curl_Multi_Strerror Func Filesystem Is File ❯

PHP Image Processing

PHP provides a rich set of image processing functions, including:

Function Description
gd_info() Retrieves information about the currently installed GD library
getimagesize() Gets image information
getimagesizefromstring() Gets image information from string
image_type_to_extension() Gets the image file extension
image_type_to_mime_type() Returns the MIME type of the image
image2wbmp() Outputs a WBMP image
imageaffine() Returns an image after affine transformation
imageaffinematrixconcat() Concatenates two matrices
imageaffinematrixget() Gets a matrix
imagealphablending() Sets the blending mode for an image
imageantialias() Whether to use antialiasing functionality
imagearc() Draws an elliptical arc
imagechar() Draws a horizontal character
imagecharup() Draws a vertical character
imagecolorallocate() Allocates a color for an image
imagecolorallocatealpha() Allocates a color and alpha for an image
imagecolorat() Gets the index of the color of a pixel
imagecolorclosest() Gets the index of the closest color to the specified color
imagecolorclosestalpha() Gets the index of the closest color to the specified color plus alpha
imagecolorclosesthwb() Gets the index of the closest color in hue, white, and black
imagesx() , imagesy() Gets the width and height of an image

GD Library

To use PHP image processing functions, the GD support library needs to be loaded. Ensure that the GD library is loaded in php.ini:

On Windows servers:

extension = php_gd2.dll

On Linux and Mac systems:

extension = php_gd2.so

The gd_info() function can be used to view information about the currently installed GD library:

<?php
var_dump(gd_info());
?>

The output is roughly as follows:

array(12) {
  ["GD Version"]=>
  string(26) "bundled (2.1.0 compatible)"
  ["FreeType Support"]=>
  bool(true)
  ["FreeType Linkage"]=>
  string(13) "with freetype"
  ["T1Lib Support"]=>
  bool(false)
  ["GIF Read Support"]=>
  bool(true)
  ["GIF Create Support"]=>
  bool(true)
  ["JPEG Support"]=>
  bool(true)
  ["PNG Support"]=>
  bool(true)
  ["WBMP Support"]=>
  bool(true)
["XPM Support"]=>
  bool(false)
  ["XBM Support"]=>
  bool(true)
  ["JIS-mapped Japanese Font Support"]=>
  bool(false)
}
❮ Func Curl_Multi_Strerror Func Filesystem Is File ❯