PHP development verification code creation canvas
Everyone should pay attention, when learning to make verification codes, we need to open the manual
The function of making verification codes is relatively long
imagecreatetruecolor(); Create a canvas, let’s see below His syntax
Syntax:
resource imagecreatetruecolor (int $width, int $height)
Description: Return a Image identifier, width is $width and height is $height
Returns the image resource after success, returns FALSE after failure.
After we create a canvas, we need to assign a color to the canvas
imagecolorallocate
Syntax:
int imagecolorallocate ( resource $image , int $red , int $green , int $blue );
The first parameter,returns a resource type, and the subsequent parameters are in RGB format Color
How to output the image
header("content-type:image/png");
imagepng($image);
Destroy resources