<?php
# procent wykonania (mozna pobierac z formularza)
$percent = 45;
# szerokosc paska w pikselach
$progress['width'] = 100;
# wysokosc paska w pikselach
$progress['height'] = 13;
# kolor tla paska
$progress['color'] = 'FFFFFF';
# kolor paska
# mozna zrobic dynamiczny... musisz sie pobawic :)
$progress['line'] = 'FF0000';
# kolor ramki paska
$progress['border'] = '888888';
# kolor czcionki
$progress['font'] = '000000';
# modyfikujemy kolory na czerwony, zielony i niebieski
$img = imagecreatetruecolor($progress['width'], $progress['height'])
or
die('Nie można utworzyć obrazu GD');
# robimy ramke
$border_color = imagecolorallocate($img, $border_r, $border_g, $border_b);
$fill_color = imagecolorallocate($img, $color_r, $color_g, $color_b);
$font_color = imagecolorallocate($img, $font_r, $font_g, $font_b);
# kolorujemy caly pasek
imagefill($img, 0, 0, $fill_color);
$line_color = imagecolorallocate($img, $line_r, $line_g, $line_b);
$width = $progress['width']; $width--;
$height = $progress['height']; $height--;
imagerectangle($img, 0, 0, $width, $height, $border_color);
$new_x = round(($percent*$progress['width'])/100
); #usuwamy jeden piksel w szerokosci na ramke
$new_x-= 3;
$new_y = $progress['height'];
# j/w
$new_y-= 3;
imagefilledrectangle($img, 2, 2, $new_x, $new_y, $line_color);
$font_x = $progress['width']/2;
$font_x-= 3;
$font_y = $progress['height']/2;
$font_y-= 3;
imagestring($img, 1, $font_x, $font_y, $percent.'%', $font_color);
header(\"Content-type: image/png\"); imagepng($img);
imagedestroy($img);
?>
Właśnie napisałem
45 minut roboty ale jest
Jeżeli chodzi o napis to można go usunać albo zastąpić
imagettftext, który daje ładniejszy wygląd
pozdro!