Summary of commonly used functions of PHP image processing component GD - Overview
PHP has a series of very powerful graphics processing functions. They are all included in the GD library. These functions have basically satisfied the needs of a network application. routine image processing requirements and is very simple to use.
Many of our PHP friends (including me) think that these functions are not very commonly used anyway, and are too lazy to study or understand these functions. When faced with image processing, they are at a loss. , calligraphy is used to spend time and regret less!
This series of articles is to summarize the image processing functions of PHP for everyone. It does not require mastery. I just hope that you can have a general impression of these functions. At the very least, when you have discussions or questions about image processing , you can think of these functions in your mind, so that everyone can be confident when thinking of solutions! There’s a lot of nonsense!
This article is the beginning, so let’s first talk about the GD library related to these functions, as well as the classification of the functions. The following articles will be detailed according to the classification.
PHP functions are all in the GD library. If you want to use the GD library, PHP needs to enable GD library support. Since this series of articles is not for rookies, I will not talk about how to enable GD library support. La.
PHP's image processing functions are roughly divided into several categories:
1. Basic information functions
Mainly the most basic functions such as image type, image width and height, and library version.
2. Image conversion function
Contains mutual conversion functions between image formats
3. Image creation and destruction functions
Contains functions for various ways to create images and destroy image processing related resources Functions
4. Drawing operation functions
include drawing-related functions, such as drawing lines, circles, squares, etc.
5. Image operation functions
Functions that perform some effect processing on images
6. Image setting function
Set some parameters of the image, such as: the width of the drawn line, whether the image is transparent, whether it is true color, etc.
7. Image text function
writes on the image Some functions of
8. Image output function
Once the image is done, it must be output. These functions are used for output. Where should it be output? Browsers, files, etc.
I’ll talk about these at the beginning, and the next few articles will talk about these functions by category.
Summary of commonly used functions of PHP image processing component GD - basic information functions
Basic information functions mainly include the following:
gd_info
Current PHP environment GD library Basic information
imagetypes
Supported image types
getimagesize
Get the size of an image
imagecolorat
Get the color index value of a certain pixel of the image
imagesx
Get the image width
imagesy
Get the image height
Let’s talk about it in detail below!
gd_info
Get information about the currently installed GD library and return an array
Array key meaning:
GD Version
string value. Describes the version of libgd installed.
Freetype Support
boolean value. TRUE if Freetype support is installed.
Freetype Linkage
string value. Describes Freetype connection methods. Possible values are: 'with freetype', 'with TTF library' and 'with unknown library'. This unit is only defined when Freetype Support is TRUE.
T1Lib Support
boolean value. TRUE if T1Lib support is included.
GIF Read Support
boolean value. TRUE if support for reading GIF images is included.
GIF Create Support
boolean value. TRUE if support for creating GIF images is included.
JPG Support
boolean value. TRUE if JPG support is included.
PNG Support
boolean value. TRUE if PNG support is included.
WBMP Support
boolean value. TRUE if WBMP support is included.
XBM Support
boolean value. TRUE if XBM support is included.
For example: