Home Backend Development PHP Tutorial PHP generates 3D percentage graphic statistical effects_PHP tutorial

PHP generates 3D percentage graphic statistical effects_PHP tutorial

Jul 13, 2016 am 10:45 AM
php graphics supply Effect yes generate user percentage of program statistics

PHP generates 3D percentage graphic statistical effects This program is based on the data provided by the user to generate a 3D percentage image statistical effect, which is a bit like the Chinese webmaster

PHP tutorial to generate a 3D percentage graphic statistical effect
/*
This program generates 3D effect percentage picture statistics based on the data provided by the user. The effect is a bit like a Chinese webmaster
*/
$image = imagecreatetruecolor(200,200); //Create a 200*200 canvas;

//Create multiple and differentiated colors
$red = imagecolorallocate($image,255,0,0);
$blue = imagecolorallocate($image,0,0,255);
$yellow = imagecolorallocate($image,255,255,0);
$violet = imagecolorallocate($image,255,0,255);
$white = imagecolorallocate($image,255,255,255);
$black = imagecolorallocate($image,0,0,0);


//Use a for loop to create the underlying 3D effect
for($i=120;$i>100;$i--){
Imagefilledarc($image,100,$i,200,120,0,30,$red,img_arc_pie);//img_arc_pie annotation is as follows:

imagefilledarc($image,100,$i,200,120,30,80,$blue,img_arc_pie);
Imagefilledarc($image,100,$i,200,120,80,360,$yellow,img_arc_pie);
}
//bool imagefilledarc (resource image, int cx, int cy, int w, int h, int s, int e, int color, int style)
//
//imagefilledarc() draws an elliptical arc using cx, cy (the upper left corner of the image is 0, 0) in the image represented by image. Returns true if successful, false if failed. w and h specify the width and height of the ellipse respectively, and the s and e parameters specify the start and end points in angles. style can be the bitwise OR (or) of the following values:
//
//img_arc_pie
//
//img_arc_chord
//
//img_arc_nofill
//
//img_arc_edged


//This layer is the effect of the top layer, so that the three-dimensional effect comes out!
Imagearc($image,100,100,200,120,0,360,$black);//Add a black border so that the 3D effect looks more obvious
Imagefilledarc($image,100,100,200,120,0,30,$red,img_arc_pie);
Imagefilledarc($image,100,100,200,120,30,80,$blue,img_arc_pie);
Imagefilledarc($image,100,100,200,120,80,360,$yellow,img_arc_pie);

//Add percentage data. Of course, if necessary, you can perform certain operations in batches and input the input to the picture
$str = iconv ("gbk","utf-8","36%");//This conversion is required if you want to input Chinese. example: Occupied: 30%;
Imagettftext($image,10,360-15,100+70,115,$white,"simhei.ttf",$str);

imagejpeg($image);
imagedestroy($image);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633030.htmlTechArticlePHP generates 3D percentage graphic statistical effects. This program generates 3D percentage graphic statistical effects based on the data provided by the user. It's a bit like the Chinese webmaster's php tutorial to generate 3D percentage graphics...
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

See all articles