codice:
function status_project($percent, $projname='prjstat.png') {
$statusLEN = 400;
$percent_len = ($statusLEN/100)*$percent; # (statusLEN/100)*percent
$im = imagecreate($statusLEN, 20) or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 255, 255, 255);
$black_color = imagecolorallocate($im, 0, 0, 0);
$bar_color = imagecolorallocate($im, 222, 231, 236);
$text_color = imagecolorallocate($im, 0, 0, 0);
# int imagefilledrectangle ( resource image, int x1, int y1, int x2, int y2, int color);
imagefilledrectangle($im, 0, 0, $percent_len, 20, $bar_color);
imagefilledrectangle($im, $percent_len, 0, $percent_len, 19, $black_color);
# Image Border...
imagefilledrectangle($im, 0, 0, $statusLEN-1, 0, $black_color);
imagefilledrectangle($im, 0, 19, $statusLEN-1, 19, $black_color);
imagefilledrectangle($im, 0, 0, 0, 19, $black_color);
imagefilledrectangle($im, $statusLEN-1, 0, $statusLEN-1, 19, $black_color);
# int imagestring ( resource image, int font, int x, int y, string s, int col);
imagestring($im, 5, ($statusLEN/2)-7, 2, "${percent}%", $text_color);
imagepng($im, $projname);
imagedestroy($im);
return($projname);
}
Grazie !