This article summarizes the image generation and processing functions related to the PHP GD library. I share it with you for your reference. The details are as follows:
In the past few days, I have been learning about image verification codes. I have referred to many examples, all of which use the GD library to generate and draw images, so I plan to encapsulate the GD library into classes for use. By the way, also learn and practice the object-oriented part of PHP.
First analyze the functions provided by the GD library and divide them according to their functions: (These are only commonly used basic-level functions, more advanced functions will be studied later)
1. create // Image generation
A. Draw image
1 2 | imageCreate
imageCreateTrueColor
|
Copy after login
B. Create image from image
1 | imageCreateFrom*(*=gd2/gd2part/gd/gif/jpeg/png/string/wbmp/xbm/xpm)
|
Copy after login
C.copy
1 2 3 4 5 | imageCopy
imageCopyMerge
imageCopyMergeGray
imageCopyResampled
imageCopyResized
|
Copy after login
2. draw // Draw
A.point // point
B.line // Line
1 2 3 4 | imageLine
imageArc
imageFilledArc
imageDashedLine
|
Copy after login
C.graph // Graph
1 2 3 4 5 6 | imageEllipse
imageFilledEllipse
imageRectangle
imageFilledRectangle
imagePolygon
imageFilledPolygon
|
Copy after login
D.text // Text
1 2 3 4 5 6 7 | imageChar
imageCharUp
imageString
imageStringUp
imageTtfText
imageFtText
imagePsText
|
Copy after login
E. fill // fill
1 2 | imageFill
imageFillToBorder
|
Copy after login
color
1 2 | imageColorAllocate
imageColorAllocateAlpha
|
Copy after login
B.show
1 2 3 4 5 6 7 8 9 | getImageSize
getImageSizeFromString
image_type_to_extension
image_type_to_mime_type
imageColorAt
imageFontWidth
imageFontHeight
imageSx
imageSy
|
Copy after login
6. destroy // Destroy
1 2 3 | image2Wbmp
jpeg2Wbmp
png2Wbmp
|
Copy after login
I hope this article will be helpful to everyone in PHP program design.
For more articles related to summary of image generation and processing functions of PHP GD library, please pay attention to PHP Chinese website!