English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP provides a wealth of image processing functions, mainly including:
Function | Description |
---|---|
gd_info() | Get information about the installed GD library |
getimagesize() | Get image information |
getimagesizefromstring() | Get image information |
image_type_to_extension() | Get the image suffix |
image_type_to_mime_type() | Return the MIME type of the image |
image2wbmp() | Output WBMP image |
imageaffine() | Return the image after affine transformation |
imageaffinematrixconcat() | Concatenate two matrices |
imageaffinematrixget() | Obtain the matrix |
imagealphablending() | Set the mixing mode of the image |
imageantialias() | Whether to use the antialias (antialias) feature |
imagearc() | Draw an elliptical arc |
imagechar() | Write horizontal characters |
imagecharup() | Draw a character vertically |
imagecolorallocate() | Allocate color for an image |
imagecolorallocatealpha() | Allocate color and opacity for an image |
imagecolorat() | Get the color index value of a pixel |
imagecolorclosest() | Get the index value of the closest color to the specified color |
imagecolorclosestalpha() | Get the index of the closest color with transparency to the specified color |
imagecolorclosesthwb() | Get the index of the closest grayscale shade to the specified color |
imagesx() , imagesy() | Get image width and height |
To use PHP image processing functions, you need to load the GD support library. Please make sure 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
You can use the gd_info() function to view information about the currently installed GD library:
<?php var_dump(gd_info()); ?>
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) }