<html><head></head><body>Index: quotaimg.php
|
|
|
|
| 22 | 22 | $quota = ((isset($_GET['q']) && !empty($_GET['q'])) || $_GET['q']=='0')?(int)$_GET['q']:'??'; |
| 23 | 23 | $width = empty($_GET['w']) ? 100 : (int)$_GET['w']; |
| 24 | 24 | $height = empty($_GET['h']) ? 14 : (int)$_GET['h']; |
| | 25 | $showsizes = ( isset($_GET['showsizes']) ? ($_GET['showsizes']=='true') : false); |
| 25 | 26 | |
| 26 | 27 | /** |
| 27 | 28 | * Quota display |
| … |
… |
|
| 62 | 63 | * |
| 63 | 64 | * @todo Make colors a config option. |
| 64 | 65 | */ |
| 65 | | function genQuota($used, $total, $width, $height) |
| | 66 | function genQuota($used, $total, $width, $height, $showsizes) |
| 66 | 67 | { |
| 67 | 68 | $unknown = false; |
| 68 | 69 | $border = 0; |
| … |
… |
|
| 159 | 160 | } |
| 160 | 161 | |
| 161 | 162 | $quota_width = $quota / 100 * $width; |
| 162 | | imagefilledrectangle($im, $border, 0, $quota, $height-2*$border, $fill); |
| | 163 | imagefilledrectangle($im, $border, 0, $quota_width, $height-2*$border, $fill); |
| 163 | 164 | |
| 164 | 165 | $string = $quota . '%'; |
| | 166 | if ($showsizes) |
| | 167 | $string .= ' (' . round($used/1000,0) . '/' . round($total/1000,0) . 'MB)'; |
| | 168 | |
| 165 | 169 | $mid = floor(($width-(strlen($string)*imagefontwidth($font)))/2)+1; |
| 166 | 170 | // Print percent in black |
| 167 | 171 | imagestring($im, $font, $mid, $padding, $string, $text); |
| … |
… |
|
| 178 | 182 | imagedestroy($im); |
| 179 | 183 | } |
| 180 | 184 | |
| 181 | | genQuota($used, $quota, $width, $height); |
| | 185 | genQuota($used, $quota, $width, $height, $showsizes); |
| 182 | 186 | exit; |