$goal) { $current = 100; $percent= "100%!"; } else if ($current == "" || $current == "0") { $percent = "0%"; } else { $percent = round(($current/$goal)*100) . "%"; } $im = @imagecreate($width,$height) or die("Cannot Initialize new GD image stream"); $bg = ImageColorAllocate($im,200,200,200); // grey $fg = ImageColorAllocate($im,255,0,0); //red $text_color = imagecolorallocate($im, 0, 0, 0); //black $fill = $height-(($current/$goal)*$height); imagefilledrectangle($im, 0, $fill, $width, $height, $fg); imagestring($im, 3, 2, 2, $percent, $text_color); imagepng($im); imagedestroy($im); } ?>