1, the use of PHP functions of the GD library to draw 3D sector statistics
<?php
Header ("Content-type", "text/html;charset=utf-8");
/* Sector Chart * *
$image = Imagecreatetruecolor (100, 100); /* Create Canvas * *
/* Set the color required for the canvas * *
$white = Imagecolorallocate ($image, 0xff,0xff,0xff);
$gray = Imagecolorallocate ($image, 0xc0, 0xc0, 0xc0);
$darkgray = Imagecolorallocate ($image, 0x90, 0x90, 0x90);
$navy = Imagecolorallocate ($image, 0x00, 0x00, 0x80);
$darknavy = Imagecolorallocate ($image, 0x00, 0x00, 0x50);
$red = Imagecolorallocate ($image, 0xFF, 0x00, 0x00);
$darkred = Imagecolorallocate ($image, 0x90, 0x00, 0x00);
/* Fill Background color * *
Imagefill ($image, 0, 0, $white);
/*3d Making * *
for ($i = $i > $i-)
{
Imagefilledarc ($image, $i, M, -160, $darknavy, Img_arc_pie);
Imagefilledarc ($image, $i, M, N, $darkgray, Img_arc_pie);
Imagefilledarc ($image, $i, M, N, $darkred, Img_arc_pie);
}
/* Draw ellipse arc and fill/*
Imagefilledarc ($image, M, -160, $darknavy, Img_arc_pie);
Imagefilledarc ($image, $darkgray, M, Img_arc_pie);;
Imagefilledarc ($image, N, $darkred, Img_arc_pie), and
/* Draw String * *
Imagestring ($image, 3,,, "30%", $white);
Imagestring ($image, 3, A, "60%", $white);
Imagestring ($image, 3,,, "10%", $white);
/* Output Image * *
Header ("Content-type:image/png");
Imagepng ($image);
/* Release of resources * *
Imagedestroy ($image);
?>
Effect:
2, zoom to the picture
<div>
</div>
<?php
Header ("Content-type", "text/html;charset=utf-8");
/*
* Picture Scaling
* @param string $filename The URL of the picture
* @param int $width Set the maximum width of picture scaling
* @param int $height Set the maximum height of picture scaling
*/
function Thumb ($filename, $width =130, $height =130)
{
/* Get the size of the original * *
List ($width _orig, $height _orig) = getimagesize ($filename);
/* According to the parameters $width and $height, the conversion of equal proportions of the height and width * *
if ($width && ($width _orig < $height _orig))
{
$width = ($height/$height _orig) * $width _orig;
}
Else
{
$height = ($width/$width _orig) * $height _orig;
}
/* Create canvas with new size * *
$image _p = Imagecreatetruecolor ($width, $height);
/* Get Image resources * *
$image = Imagecreatefrompng ($filename);
/* Use imagecopyresampled Zoom * *
Imagecopyresampled ($image _p, $image, 0, 0, 0, 0, $width, $height, $width _orig, $height _orig);
/* Save scaled Picture and name * *
Imagepng ($image _p, ' test.png ');
/* Release of resources * *
Imagedestroy ($image _p);
Imagedestroy ($image);
}
/* Call Function * *
Thumb (' 1.png ');
?>
<div>
</div>
Effect: