1 |
ravilov |
1.1 |
<?php |
2 |
ravilov |
1.2 |
include_once("inc/sem_stat.php"); |
3 |
ravilov |
1.1 |
$fontsize = 7; // pixels |
4 |
ravilov |
1.2 |
if ($msg) { |
5 |
|
|
$map = array( |
6 |
|
|
"è" => 269, "è" => 269, |
7 |
|
|
"æ" => 263, "æ" => 263, |
8 |
|
|
"¹" => 353, "" => 353, |
9 |
|
|
"¾" => 382, "" => 382, |
10 |
|
|
"ð" => 273, "ð" => 273, |
11 |
|
|
"È" => 268, "È" => 268, |
12 |
|
|
"Æ" => 262, "Æ" => 262, |
13 |
|
|
"©" => 352, "" => 352, |
14 |
|
|
"®" => 381, "" => 381, |
15 |
|
|
"Ð" => 272, "Ð" => 272 |
16 |
|
|
); |
17 |
|
|
while (list($k, $v) = each($map)) $msg = str_replace($k, "&#".$v.";", $msg); |
18 |
|
|
$msg = preg_replace("/\\\(.)/", '$1', $msg); |
19 |
|
|
} |
20 |
ravilov |
1.1 |
$im = ImageCreateFromPNG("img/semafor.png"); |
21 |
|
|
$black = ImageColorAllocate($im, 0x00, 0x00, 0x00); |
22 |
|
|
$white = ImageColorAllocate($im, 0xFF, 0xFF, 0xFF); |
23 |
|
|
$red = ImageColorAllocate($im, 0xE3, 0x19, 0x24); |
24 |
|
|
$yellow = ImageColorAllocate($im, 0xED, 0xD2, 0x05); |
25 |
|
|
$green = ImageColorAllocate($im, 0x66, 0xCC, 0x66); |
26 |
ravilov |
1.2 |
if ($stabla[0]) ImageFill($im, 22, 51, $red); |
27 |
|
|
if ($trave[0]) ImageFill($im, 59, 51, $red); |
28 |
|
|
if ($korov[0]) ImageFill($im, 97, 51, $red); |
29 |
|
|
if ($stabla[1]) ImageFill($im, 22, 68, $yellow); |
30 |
|
|
if ($trave[1]) ImageFill($im, 59, 68, $yellow); |
31 |
|
|
if ($korov[1]) ImageFill($im, 97, 68, $yellow); |
32 |
|
|
if ($stabla[2]) ImageFill($im, 22, 86, $green); |
33 |
|
|
if ($trave[2]) ImageFill($im, 59, 86, $green); |
34 |
|
|
if ($korov[2]) ImageFill($im, 97, 86, $green); |
35 |
ravilov |
1.1 |
$date = "zagreb ".strftime("%d.%m.%y."); |
36 |
|
|
ImageTTFText($im, $fontsize, 0, 32, 26, $white, "verdana.ttf", $date); |
37 |
|
|
ImageTTFText($im, $fontsize, 0, 10, 120, $white, "verdana.ttf", $msg); |
38 |
|
|
$types = ImageTypes(); |
39 |
|
|
if ($types & IMG_GIF) { |
40 |
|
|
Header("Content-Type: image/gif"); |
41 |
|
|
ImageGIF($im); |
42 |
|
|
} else if ($types & IMG_PNG) { |
43 |
|
|
Header("Content-Type: image/png"); |
44 |
|
|
ImagePNG($im); |
45 |
|
|
} else if ($types & IMG_JPG) { |
46 |
|
|
Header("Content-Type: image/jpeg"); |
47 |
|
|
ImageJPEG($im); |
48 |
|
|
} else if ($types & IMG_WBMP) { |
49 |
|
|
Header("Content-Type: image/vnd.wap.wbmp"); |
50 |
|
|
ImageWBMP($im); |
51 |
|
|
} |
52 |
|
|
ImageDestroy($im); |
53 |
|
|
?> |