Subversion Repositories webcounter

Rev

Rev 3 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. <?php
  2.  
  3. /*
  4.  * PHP Counter mit Reloadsperre, Textdatenbank und Graphic-Libary (without Error Images)
  5.  * (C)Copyright 2010 - 2022 Daniel Marschall
  6.  * Revision: 2022-01-09
  7.  */
  8.  
  9. abstract class VtsCounterTheme {
  10.         public $stellenMin;
  11.  
  12.         abstract protected function getImg($visitors, $hue=0);
  13.  
  14.         function outputCounterImage($visitors, $format='png', $hue=0) {
  15.                 $visitors = sprintf("% ".$this->stellenMin."d", $visitors);
  16.  
  17.                 $im = $this->getImg($visitors, $hue);
  18.  
  19.                 $format = strtolower($format);
  20.                 if ($format == 'png') {
  21.                         header('Content-Type: image/png');
  22.                         imagepng($im);
  23.                 } else if (($format == 'jpg') || ($format == 'jpeg')) {
  24.                         header('Content-Type: image/jpeg');
  25.                         imagejpeg($im);
  26.                 } else if ($format == 'gif') {
  27.                         header('Content-Type: image/gif');
  28.                         imagegif($im);
  29.                 } else if ($format == 'wbmp') {
  30.                         header('Content-Type: image/vnd.wap.wbmp');
  31.                         imagewbmp($im);
  32.                 } else {
  33.                         assert(false);
  34.                 }
  35.  
  36.                 @imagedestroy($im);
  37.         }
  38.  
  39. }
  40.