Percentage bar code

git-svn-id: http://www.observium.org/svn/observer/trunk@106 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong 2007-06-10 20:50:17 +00:00
parent 78bf4a1d80
commit 9e4f2a0b90

16
html/percentage.php Normal file
View File

@ -0,0 +1,16 @@
<?php
// returns a PNG graph from the $_GET['per'] variable
$width = '201';
$height = '7';
$per = imagecreate($width,$height);
$background = imagecolorallocate($per, 0xFF, 0xFF, 0xFF);
$foreground = imagecolorallocate($per, 0x00, 0x8A, 0x01);
$border = imagecolorallocate($per, 0x99, 0x99, 0x99);
if ($_GET['per'] > 0) {
$grad = imagecreatefrompng("images/grad.png");
$per2 = imagecopy($per, $grad, 1, 1, 0, 0, ($_GET['per'] * $width / 100), 5);
imagerectangle($per, 0, 0, $width-1, $height-1 , $border);
}
header("Content-type: image/png");
imagepng($per, '', 100);
?>