Subversion Repositories webcounter

Rev

Blame | 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 - 2017 Daniel Marschall
  6.  * Revision: 2017-05-05
  7.  */
  8.  
  9. class VtsCounterThemeImpl extends VtsCounterTheme {
  10.  
  11.         protected function getImg($visitors, $hue=0) {
  12.                 $im = ImageCreateFromPNG(__DIR__.'/bg.png');
  13.                 imagesavealpha($im, true);
  14.  
  15.                 $offset_x = 60;
  16.                 $offset_y = 16;
  17.  
  18.                 for ($i=0; $i<strlen($visitors); $i++) {
  19.                         if ($visitors[$i] == ' ') $visitors[$i] = 'x'; // don't support "blank" digits
  20.                         $digit_im = ImageCreateFromPNG(__DIR__.'/digit_'.$visitors[$i].'.png');
  21.                         $digit_w = imagesx($digit_im);
  22.                         $digit_h = imagesy($digit_im);
  23.  
  24.                         imagehue($digit_im, $hue);
  25.  
  26.                         ImageCopy($im, $digit_im, $offset_x, $offset_y, 0, 0, $digit_w, $digit_h);
  27.                         ImageDestroy($digit_im);
  28.  
  29.                         $offset_x += $digit_w + 4;
  30.                 }
  31.  
  32.                 return $im;
  33.         }
  34.  
  35. }
  36.  
  37. $themeObj = new VtsCounterThemeImpl();
  38. $themeObj->stellenMin = 6;
  39.