Home  >  Article  >  Backend Development  >  How to draw the five-star red flag in php based on the GD library, phpgd library five-star red flag_PHP tutorial

How to draw the five-star red flag in php based on the GD library, phpgd library five-star red flag_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:06:19970browse

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.

www.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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn