PHP uses GD library to draw a five-pointed star_PHP tutorial
01 $width = 500;
02 $height = 500;
03
04 $im = imagecreatetruecolor($width, $height);
05
06 $red = imagecolorallocate($im, 230, 0, 0);
07 imagefill($im, 0, 0, $red);
08
09 $yellow = imagecolorallocate($im, 255, 255, 0);
10
11 //Set the side length of the regular pentagon formed by drawing the five vertices of the five-pointed star
12 $b=100;
13 $pi=3.14/180;
14
15 $p1x = 150;
16 $p1y = 250;
17
18 $p2x = 150+(cos(36*$pi)*$b);
19 $p2y = 250-(sin(36*$pi)*$b);
20
21 $p3x = 150+(2*cos(36*$pi)*$b);
22 $p3y = 250;
23
24 $p4x = $p3x-sin(18*$pi)*$b;
25 $p4y = 250+cos(18*$pi)*$b;
26
27 $p5x = 150+sin(18*$pi)*$b;
28 $p5y = 250+cos(18*$pi)*$b;
29
30 //Connect the corresponding points and draw lines
31 imageline($im, $p1x, $p1y, $p3x, $p3y, $yellow);
32 imageline($im, $p1x, $p1y, $p4x, $p4y, $yellow);
33
34 imageline($im, $p2x, $p2y, $p4x, $p4y, $yellow);
35 imageline($im, $p2x, $p2y, $p5x, $p5y, $yellow);
36
37 imageline($im, $p3x, $p3y, $p5x, $p5y, $yellow);
38
39 header('Content-Type:image/png');
40
41 imagepng($im);
42
43 imagedestroy($im);
44
45 ?>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

VprocesserazrabotkiveB-enclosed, Мнепришлостольностьсясзадачейтерациигооглапидляпапакробоглесхетсigootrive. LEAVALLYSUMBALLANCEFRIABLANCEFAUMDOPTOMATIFICATION, ČtookazaLovnetakProsto, Kakaožidal.Posenesko

How does the Redis caching solution realize the requirements of product ranking list? During the development process, we often need to deal with the requirements of rankings, such as displaying a...

In SpringBoot, use Redis to cache OAuth2Authorization object. In SpringBoot application, use SpringSecurityOAuth2AuthorizationServer...

IIS and PHP are compatible and are implemented through FastCGI. 1.IIS forwards the .php file request to the FastCGI module through the configuration file. 2. The FastCGI module starts the PHP process to process requests to improve performance and stability. 3. In actual applications, you need to pay attention to configuration details, error debugging and performance optimization.

When developing PHP projects, we often encounter requirements such as frequent operation of databases, management of transactions, and dependency injection. If written manually, these operations are not only time-consuming and labor-intensive, but also prone to errors. Recently, I have encountered similar troubles in my projects, and handling these operations has become extremely complex and difficult to maintain. Fortunately, I found a Composer library called pxniu/study, which greatly simplified my development process. Composer can be learned through the following address: Learning address

The browser's unresponsive method after the WebSocket server returns 401. When using Netty to develop a WebSocket server, you often encounter the need to verify the token. �...
