PHP image Processing
PHP provides a wealth of image processing functions, mainly including:
function |
Description |
Gd_info () |
Get information about the currently installed GD Library |
GetImageSize () |
Get image information |
Getimagesizefromstring () |
Get image information |
Image_type_to_extension () |
Get picture suffix |
Image_type_to_mime_type () |
Returns the MIME type of an image |
Image2wbmp () |
Output wbmp Pictures |
Imageaffine () |
Returns an image after an affine transformation |
Imageaffinematrixconcat () |
Connect two matrices |
Imageaffinematrixget () |
Get matrix |
Imagealphablending () |
To set the color blending mode of an image |
Imageantialias () |
Whether to use anti-aliasing (antialias) feature |
Imagearc () |
Draw an elliptical arc |
Imagechar () |
Write horizontal characters |
Imagecharup () |
To draw a character vertically |
Imagecolorallocate () |
Assign a color to an image |
Imagecolorallocatealpha () |
Assign color and transparency to an image |
Imagecolorat () |
Gets the color index value of a pixel |
Imagecolorclosest () |
Gets the index value of the color closest to the specified color |
Imagecolorclosestalpha () |
Gets the index of the color closest to the specified color and transparency |
IMAGECOLORCLOSESTHWB () |
Gets the black-white index of the closest chroma to the specified color |
Imagesx (), Imagesy () |
Get image width and height |
GD Library
With the PHP image processing function, the GD support library needs to be loaded. Make sure PHP.ini has the GD library loaded:
On the Window server:
Extension = Php_gd2.dll
On Linux and MAC systems:
Extension = php_gd2.so
Use the Gd_info () function 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(+) "bundled (2.1.0 compatible)" ["FreeType Support"]=>BOOL (true) ["FreeType Linkage"]=>string() "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)}
PHP image Processing