php method to draw five-star red flag based on GD library, phpgd library five-star red flag
The example in this article describes the method of drawing the five-star red flag in PHP based on the GD library. Share it with everyone for your reference. The specific analysis is as follows:
Here is an example of analyzing the five-star red flag drawn by php (GD library). The code is as follows:
Copy code The code is as follows:
header("Content-Type:image/jpeg");
$ing = imagecreatetruecolor(700,410);
//Create a new true color image. The return value is an image identifier. The background defaults to black. Parameters (x_size*y_size)
$red = imagecolorallocate($ing,255,0,0);//Define background color
$yellow = imagecolorallocate($ing,237,231,32);//Define yellow
imagefill($ing,0,0,$red);//Fill color, starting from coordinates (0,0)
//Array coordinates, representing (x1,y1,x2,y2,x3,y3....x11,y11);
$a = array(90,30,108,73,157,73,119,102,135,152,93,123,52,152,66,102,29,74,76,73,90,30);
imagefilledpolygon($ing,$a,10,$yellow);//Draw a polygon: 10 represents the total number of vertices, $yellow represents the filling color
$a1 = array(229,25,229,43,248,48,229,55,229,74,217,60,198,66,210,50,197,34,218,39,229,25);
imagefilledpolygon($ing,$a1,10,$yellow);
$a2 = array(227,108,227,127,245,134,228,139,227,157,215,143,196,149,208,132,196,117,215,122,227,108);
imagefilledpolygon($ing,$a2,10,$yellow);
$a3 = array(163,184,163,204,181,211,163,216,163,234,152,220,132,225,144,209,132,193,151,199,163,184);
imagefilledpolygon($ing,$a3,10,$yellow);
$a4 = array(65,209,65,228,84,235,65,240,65,259,54,245,33,249,46,233,34,217,53,224,68,209);
imagefilledpolygon($ing,$a4,10,$yellow);
ob_clean();
imagejpeg($ing);
imagedestroy($ing);
?>
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/959880.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/959880.htmlTechArticlephp method to draw five-star red flag based on GD library, phpgd library five-star red flag This article describes the example of php based on GD library to draw five-star red flag Red flag approach. Share it with everyone for your reference. The specific analysis is as follows: This...