<?php
/*
    corz fiery gradient bar graph..
    
    designed with ampsig in mind..
    http://corz.org/dev/php/workshop/bael+corz.dynamic.php.sig.page.php
    
    feed it percent (0-100%), width, and height..
    TADA!
    
    ;o)
    (c) corz.org 2005
*/

header("Content-type: image/png");

if (isset(
$_GET['percent'])) {
    
bar_graph($_GET['percent'], 35012);
} else  { 
    
bar_graph(33,350,12); 
}

/*
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);
    
$bg imagecolorallocate($img,255,255,255); // white
    
$frame imagecolorallocate($img,0,0,0); // black
    
imagerectangle($img,0,0,$width-1,$height-1,$frame);
    for (
$i=1$i<=$bar$i++) { // you could mess with the colors here..
        
$fill imagecolorallocate($img,255-($i/255),255-(255*($i/255)),(255*($i/255))-255);
        
imagefilledrectangle($img,$i,1,$i,$height-2,$fill);
    }
    
imagefilledrectangle($img,$bar+1,1,$bar+1,$height-2,$frame);
    
imagestring ($img1$bar-imagefontwidth(1)*strlen($percent)-2,($height-imagefontheight(1))/2$percent$frame);
    
imagepng($img);
    
imagedestroy($img);
}

?>
back to the source menu
test

Welcome to corz.org!

Since switching hosts (I hope you are alright, Ed! Wherever you are …) quite a few things seems to be wonky.

Juggling two energetic boys (of very different ages) on Coronavirus lockdown, I'm unlikely to have them all fixed any time soon. Mail me! to prioritise!