This article mainly introduces PHPGD Library-related image generation and processing functions, classifies and summarizes and analyzes the functions and usage of phpGD Library-related image processing functions, for more information about image generation and processing functions of the php gd library, see the following section. We will share this with you for your reference. The details are as follows:
The image verification code has been learned over the past few days. many examples have been taken to use the GD library to generate and draw images. Therefore, we plan to encapsulate the GD library into a class for use, by the way, I also learned and practiced the PHP object-oriented section.
First, analyze the functions provided by the GD database and divide them based on the functions: (this is only a common basic-level function. more advanced functions will be studied later)
1. create // image generation
A. draw images
ImageCreate // a color palette (256 colors) image (gif/*) imageCreateTrueColor // A true color image (gif images cannot be generated)
B. create images from images
ImageCreateFrom * (* = gd2/gd2part/gd/gif/jpeg/png/string/wbmp/xbm/xpm) // create an image from the image
C. copy
ImageCopy // Copy the local image imageCopyMerge // Copy and merge the local image imageCopyMergeGray // Copy and merge the local image (grayscale) imageCopyResampled // Copy the local image (re-sample) imageCopyResized // Copy a local image (resize)
2. draw //
A. point // point
ImageSetPixel // Image point
B. line // line
ImageLine // draw a line segment imageArc // draw an elliptical arc imageFilledArc // draw an elliptical arc and fill it with imageDashedLine // draw a dotted line
C. graph // graph
ImageEllipse // draw an oval imageFilledEllipse // draw an oval and fill it with imageRectangle // draw a rectangle imageFilledRectangle // draw a rectangle and fill it with imagePolygon // draw a polygon and fill it with a polygon
D. text // text
ImageChar // draw character (horizontal) imageCharUp // draw character (vertical) imageString // draw string (horizontal) imageStringUp // draw string (vertical) imageTtfText // draw text (TrueType font) imageFtText // draw text (FreeType2 font) imagePsText // draw text (PostScript Type1 font)
E. fill // fill
ImageFill // fill color imageFillToBorder // fill to border
3. color // color
ImageColorAllocate // generated color imageColorAllocateAlpha // generated color (additional transparency)
4. attrs // attributes
GetImageSize // get the image size getImageSizeFromString // get the size of the image corresponding to the url or path image_type_to_extension // get the file format (extension) image_type_to_mime_type // Obtain the MIME type imageColorAt of the file // Retrieve the color of a certain pixel imageFontWidth // Retrieve the font width imageFontHeight // Retrieve the font height imageSx // Retrieve the image width imageSy // Obtain the image height
5. show // output (display) image
A. convert
Image2Wbmp // Convert to WBMP format and output jpeg2Wbmp // convert JPEG to WBMP format and output png2Wbmp // Convert PNG to WBMP format and output
B. show
ImageGD // output image (GD) imageGD2 // output image (GD2) imageGif // output image (GIF) imageJpeg // output image (JPEG) imagePng // output image (PNG) imageWbmp // output image (WBMP) imageXbm // output image (XBM)
6. destroy // destroy
ImageDestroy // destroy the image
I hope this article will help you with PHP programming.
For more articles about image generation and processing functions of the php gd Library, refer to the PHP Chinese website!