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 = ImageCreate(strlen($visitors)*15 + 2 - 1, 17 + 4);
  13.                 $black = imagecolorallocate($im,0,0,0);
  14.                 imagefill($im,0,0,$black);
  15.  
  16.                 $offset_x = 2;
  17.                 $offset_y = 2;
  18.  
  19.                 for ($i=0; $i<strlen($visitors); $i++) {
  20.                         if ($visitors[$i] == ' ') $visitors[$i] = 'x';
  21.                         $digit_im = ImageCreateFromPNG(__DIR__.'/digit_'.$visitors[$i].'.png');
  22.                         $digit_w = imagesx($digit_im);
  23.                         $digit_h = imagesy($digit_im);
  24.  
  25.                         imagehue($digit_im, $hue);
  26.  
  27.                         ImageCopy($im, $digit_im, $offset_x, $offset_y, 0, 0, $digit_w, $digit_h);
  28.                         ImageDestroy($digit_im);
  29.  
  30.                         $offset_x += $digit_w + 3;
  31.                 }
  32.  
  33.                 return $im;
  34.         }
  35.  
  36. }
  37.  
  38. $themeObj = new VtsCounterThemeImpl();
  39. $themeObj->stellenMin = 8;
  40.