Subversion Repositories webcounter

Rev

Rev 3 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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