1 |
<?php |
2 |
// Graph-bar |
3 |
|
4 |
$usage = round($_GET['usage']); |
5 |
|
6 |
if ($usage > 100) $usage = 100; |
7 |
if ($usage < 0) $usage = 0; |
8 |
|
9 |
$im = imagecreatefrompng('gfx/bar_template.png'); |
10 |
|
11 |
|
12 |
if ($usage > 0) { |
13 |
|
14 |
$bar_color = imagecolorallocate($im, 97, 180, 243); |
15 |
$bar_light = imagecolorallocate($im, 146, 201, 243); |
16 |
$bar_dark = imagecolorallocate($im, 44, 135, 205); |
17 |
$bar_line = imagecolorallocate($im, 75, 75, 75); |
18 |
|
19 |
imagefilledrectangle($im, 1,1, $usage, 14, $bar_color); |
20 |
|
21 |
imageline($im, 1,1, $usage, 1, $bar_light); |
22 |
imageline($im, 1,1, 1, 14, $bar_light); |
23 |
|
24 |
imageline($im, 2, 14, $usage, 14, $bar_dark); |
25 |
imageline($im, $usage, 1, $usage, 14, $bar_dark); |
26 |
|
27 |
imageline($im, $usage+1, 1, $usage+1, 14, $bar_line); |
28 |
} |
29 |
|
30 |
header('Content-type: image/png'); |
31 |
imagepng($im); |
32 |
?> |