-
-
//1. Create canvas - $im = imagecreatetruecolor(300,200);//Create a new true color image, the default background is black, and return the image identifier. There is also a function imagecreate that has been deprecated.
//2. Draw the required image
- $red = imagecolorallocate($im,255,0,0);//Create a color for use
- imageellipse($im, 30,30,40,40,$red);//Draw a circle. Parameter description: 30, 30 are the center coordinates of the circle; 40, 40 are the width and height, if they are different, it is an ellipse; $red is the color of the circle (frame color)
// 3. Output the image
- header("content-type: image/png");
- imagepng($im);//Output to the page. If there is a second parameter [,$filename], it means saving the image
//4. Destroy the image and release the memory
- imagedestroy($im);
- ?>
-
Copy code
|