/[health_html]/semafor.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /semafor.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations)
Sat Sep 29 15:24:48 2001 UTC (22 years, 7 months ago) by ravilov
Branch: MAIN
Alergic semaphor is now dynamically generated.

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

  ViewVC Help
Powered by ViewVC 1.1.26