Пример #1
0
    } else {
        $colour = $settings['colour'];
    }
}
// Default to 10 px height if they set no height.
$settings['currentHeight'] = isset($_GET['height']) && $_GET['height'] > $settings['minHeight'] ? $_GET['height'] : $settings['currentHeight'];
// Store Height
$store['height'] = $settings['currentHeight'];
// Stats class include
if (!(include_once './Stats.class.php')) {
    die('Error including Stats.class.php');
}
// Instantiate instance of class
$stats = new Stats();
// Store the stats!
$stats->store($store);
// Set the content-type to png
header("Content-type: image/png");
// Create an image at the right dimensions.
$im = imagecreate(4, $settings['currentHeight']);
// Declare some colours
$white = imagecolorallocate($im, 255, 255, 255);
if (count($colour) == 4) {
    $line = imagecolorallocatealpha($im, $colour[0], $colour[1], $colour[2], 127 - $colour[3] * 127);
} else {
    $line = imagecolorallocatealpha($im, $colour[0], $colour[1], $colour[2], 100);
}
// Set the image to use white as transparent
imagecolortransparent($im, $white);
// Draw a line starting bottom left, for 2px along
imageline($im, 0, $settings['currentHeight'] - 1, 2, $settings['currentHeight'] - 1, $line);
Пример #2
0
 public function updateStats()
 {
     $stats = $this->driver->info();
     Stats::store('stats', $stats);
 }