corz.org uses cookies to remember that you've seen this notice explaining that corz.org uses cookies, okay!
<?php
// a simple modification to the gradient code, to get stripes (log mono version)
// note: if your sig is > 255 px wide, the stripes won't go all the way. why?
header("Content-type: image/png");
if ($percent = @$_GET['percent']) { bar_graph($percent,350,14); } else { bar_graph(100,300,30); }
/*
function bar graph($score (%), $width (px), $height(px) */
function bar_graph($score,$width,$height) {
$percent = $score.'%';
$bar = (($score/100) * $width)-2;
$img = imagecreate($width,$height);
$frame = imagecolorallocate($img,0,0,0); // black
$bg = imagecolorallocate($img,255,255,255); // white
imagerectangle($img,0,0,$width-1,$height-1,$frame);
for ($i=1; $i<=$bar; $i++) { // you could mess with the colors here..
if ((1500 % $i) <= 70) {
$fill = imagecolorallocate($img,255,255,255); // white
} else {
$fill = imagecolorallocate($img,0,0,0); // black
}
imagefilledrectangle($img,$i,3,$i,$height-4,$fill);
}
imagefilledrectangle($img,$bar+1,1,$bar+1,$height-2,$bg);
imagestring ($img, 2, $bar-imagefontwidth(2)*strlen($percent)-2,($height-imagefontheight(2))/2, $percent, $frame);
imagepng($img);
imagedestroy($img);
}