English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
PHP fournit une riche gamme de fonctions de traitement d'images, notamment :
fonction | description |
---|---|
gd_info() | obtenir les informations de la bibliothèque GD installée |
getimagesize() | obtenir les informations de l'image |
getimagesizefromstring() | obtenir les informations de l'image |
image_type_to_extension() | obtenir le suffixe de l'image |
image_type_to_mime_type() | retourner le type MIME de l'image |
image2wbmp() | sortir l'image WBMP |
imageaffine() | retourner l'image après transformation affine |
imageaffinematrixconcat() | joindre deux matrices |
imageaffinematrixget() | obtenir la matrice |
imagealphablending() | 设定图像的混色模式 |
imageantialias() | 是否使用抗锯齿(antialias)功能 |
imagearc() | 画椭圆弧 |
imagechar() | 写出横向字符 |
imagecharup() | 垂直地画一个字符 |
imagecolorallocate() | 为一幅图像分配颜色 |
imagecolorallocatealpha() | 为一幅图像分配颜色和透明度 |
imagecolorat() | 取得某像素的颜色索引值 |
imagecolorclosest() | 取得与指定的颜色最接近的颜色的索引值 |
imagecolorclosestalpha() | 取得与指定的颜色加透明度最接近的颜色的索引 |
imagecolorclosesthwb() | 取得与指定的颜色最接近的色度的黑白色的索引 |
imagesx() 、imagesy() | 获取图像宽度与高度 |
使用 PHP 图像处理函数,需要加载 GD 支持库。请确定 php.ini 加载了 GD 库:
Window 服务器上:
extension = php_gd2.dll
Linux 和 Mac 系统上:
extension = php_gd2.so
使用 gd_info() 函数可以查看当前安装的 GD 库的信息:
<?php var_dump(gd_info()); ?>
输出大致如下:
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) }