<?php
/*
* Created on 2009-5-26
*author:deepblue
*/
$image = Imagecreatetruecolor (200,200); Create a 200*200 canvas;
Create multiple, 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);
Create a 3D effect bottom effect with a for loop
For ($i =120 $i >100; $i-) {
Imagefilledarc ($image, MB, $i, 200,120,0,30, $red, img_arc_pie);//img_arc_pie notes are as follows:
Imagefilledarc ($image, MB, $i, 200,120,30,80, $blue, Img_arc_pie);
Imagefilledarc ($image, MB, $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 in the image represented by Cx,cy (0, 0 in the upper-left corner of the image). Returns TRUE if successful, and returns FALSE if it fails. W and H Specify the width and height of the ellipse respectively, and the S and e parameters specify the starting and ending points at the angle. The style can be a value that is bitwise OR (or) of the following values:
//
Img_arc_pie
//
Img_arc_chord
//
Img_arc_nofill
//
Img_arc_edged
This layer is the top layer of the effect, so that the stereo effect came out!
Imagearc ($image, 100,100,200,120,0,360, $black);//Add a black rim 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 percent data, of course, when necessary, in batches to carry out a certain operation input to the picture
$str = Iconv ("GBK", "UTF-8", "36%");//If you want to enter Chinese, you need this conversion. Example: Occupy: 30%;
Imagettftext ($image, 10,360-15,100+70,115, $white, "Simhei.ttf", $str);
Imagejpeg ($image);
Imagedestroy ($image);
?>