pled-display
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
$chars = array(
32=> array("00000","00000","00000","00000","00000","00000","00000","00000"),
33=> array("00100","00100","00100","00100","00100","00000","00100","00000"),
34=> array("01010","01010","01010","00000","00000","00000","00000","00000"),
35=> array("01010","01010","11111","01010","11111","01010","01010","00000"),
36=> array("00100","01111","10100","01110","00101","11110","00100","00000"),
37=> array("11000","11001","00010","00100","01000","10011","00011","00000"),
38=> array("01100","10010","10100","01000","10101","10010","01101","00000"),
39=> array("01100","00100","01000","00000","00000","00000","00000","00000"),
40=> array("00010","00100","01000","01000","01000","00100","00010","00000"),
41=> array("01000","00100","00010","00010","00010","00100","01000","00000"),
42=> array("00000","00100","10101","01110","10101","00100","00000","00000"),
43=> array("00000","00100","00100","11111","00100","00100","00000","00000"),
44=> array("00000","00000","00000","00000","01100","00100","01000","00000"),
45=> array("00000","00000","00000","11111","00000","00000","00000","00000"),
46=> array("00000","00000","00000","00000","00000","01100","01100","00000"),
47=> array("00000","00001","00010","00100","01000","10000","00000","00000"),
48=> array("01110","10001","10011","10101","11001","10001","01110","00000"),
49=> array("00100","01100","00100","00100","00100","00100","11111","00000"),
50=> array("01110","10001","00001","00010","00100","01000","11111","00000"),
51=> array("11111","00010","00100","00010","00001","10001","01110","00000"),
52=> array("00010","00110","01010","10010","11111","00010","00010","00000"),
53=> array("11111","10000","11110","00001","00001","10001","01110","00000"),
54=> array("00110","01000","10000","11110","10001","10001","01110","00000"),
55=> array("11111","00001","00010","00100","01000","01000","01000","00000"),
56=> array("01110","10001","10001","01110","10001","10001","01110","00000"),
57=> array("01110","10001","10001","01111","00001","00010","01100","00000"),
58=> array("00000","01100","01100","00000","01100","01100","00000","00000"),
59=> array("00000","01100","01100","00000","01100","00100","01000","00000"),
60=> array("00010","00100","01000","10000","01000","00100","00010","00000"),
61=> array("00000","00000","11111","00000","11111","00000","00000","00000"),
62=> array("01000","00100","00010","00001","00010","00100","01000","00000"),
63=> array("01110","10001","00001","00010","00100","00000","00100","00000"),
64=> array("01110","10001","00001","01101","10101","10101","01110","00000"),
65=> array("01110","10001","10001","11111","10001","10001","10001","00000"),
66=> array("11110","10001","10001","11110","10001","10001","11110","00000"),
67=> array("01110","10001","10000","10000","10000","10001","01110","00000"),
68=> array("11110","10001","10001","10001","10001","10001","11110","00000"),
69=> array("11111","10000","10000","11110","10000","10000","11111","00000"),
70=> array("11111","10000","10000","11110","10000","10000","10000","00000"),
71=> array("01110","10001","10000","10111","10001","10001","01111","00000"),
72=> array("10001","10001","10001","11111","10001","10001","10001","00000"),
73=> array("01110","00100","00100","00100","00100","00100","01110","00000"),
74=> array("00111","00010","00010","00010","00010","10010","01100","00000"),
75=> array("10001","10010","10100","11000","10100","10010","10001","00000"),
76=> array("10000","10000","10000","10000","10000","10000","11111","00000"),
77=> array("10001","11011","10101","10001","10001","10001","10001","00000"),
78=> array("10001","10001","11001","10101","10011","10001","10001","00000"),
79=> array("01110","10001","10001","10001","10001","10001","01110","00000"),
80=> array("11110","10001","10001","11110","10000","10000","10000","00000"),
81=> array("01110","10001","10001","10001","10101","10010","01101","00000"),
82=> array("11110","10001","10001","11110","10100","10010","10001","00000"),
83=> array("01110","10001","10000","01110","00001","10001","01110","00000"),
84=> array("11111","00100","00100","00100","00100","00100","00100","00000"),
85=> array("10001","10001","10001","10001","10001","10001","01110","00000"),
86=> array("10001","10001","10001","10001","10001","01010","00100","00000"),
87=> array("10001","10001","10001","10001","10101","10101","01010","00000"),
88=> array("10001","10001","01010","00100","01010","10001","10001","00000"),
89=> array("10001","10001","01010","00100","00100","00100","00100","00000"),
90=> array("11111","00001","00010","00100","01000","10000","11111","00000"),
91=> array("01110","01000","01000","01000","01000","01000","01110","00000"),
92=> array("10001","01010","11111","00100","11111","00100","00100","00000"),
93=> array("01110","00010","00010","00010","00010","00010","01110","00000"),
94=> array("00100","01010","10001","00000","00000","00000","00000","00000"),
95=> array("00000","00000","00000","00000","00000","00000","11111","00000"),
96=> array("00100","00010","00000","00000","00000","00000","00000","00000"),
97=> array("00000","00000","01110","00001","01111","10001","01111","00000"),
98=> array("10000","10000","10110","11001","10001","10001","11110","00000"),
99=> array("00000","00000","01110","10000","10000","10001","01110","00000"),
100=> array("00001","00001","01101","10011","10001","10001","01111","00000"),
101=> array("00000","00000","01110","10001","11111","10000","01110","00000"),
102=> array("00110","01001","01000","11100","01000","01000","01000","00000"),
103=> array("00000","00000","01111","10001","10001","01111","00001","01110"),
104=> array("10000","10000","10110","11001","10001","10001","10001","00000"),
105=> array("00100","00000","01100","00100","00100","00100","01110","00000"),
106=> array("00010","00000","00110","00010","00010","00010","10010","01100"),
107=> array("10000","10000","10010","10100","11000","10100","10010","00000"),
108=> array("01100","00100","00100","00100","00100","00100","01110","00000"),
109=> array("00000","00000","11010","10101","10101","10001","10001","00000"),
110=> array("00000","00000","10110","11001","10001","10001","10001","00000"),
111=> array("00000","00000","01110","10001","10001","10001","01110","00000"),
112=> array("00000","00000","11110","10001","11110","10000","10000","00000"),
113=> array("00000","00000","01101","10011","01111","00001","00001","00000"),
114=> array("00000","00000","10110","11001","10000","10000","10000","00000"),
115=> array("00000","00000","01110","10000","01110","00001","11110","00000"),
116=> array("00000","01000","11110","01000","01000","01001","00110","00000"),
117=> array("00000","00000","10001","10001","10001","10011","01101","00000"),
118=> array("00000","00000","10001","10001","10001","01010","00100","00000"),
119=> array("00000","00000","10001","10001","10101","10101","01010","00000"),
120=> array("00000","00000","10001","01010","00100","01010","10001","00000"),
121=> array("00000","00000","10001","10001","10001","01111","00001","01110"),
122=> array("00000","00000","11111","00010","00100","01000","11111","00000"),
123=> array("00010","00100","00100","01000","00100","00100","00010","00000"),
124=> array("00100","00100","00100","00100","00100","00100","00100","00000"),
125=> array("01000","00100","00100","00010","00100","00100","01000","00000"),
);
header('content-type: image/jpeg');
$lcd = "display.jpg";
$col = 0; // x-positie (0-15)
// $_GET's : zelf beveiligen...
$text = $_GET["q"]; // tekst (max 16 chars)
$cl = $_GET['c']; // kleur
$br = $_GET['b']; // helderheid (0=max - 127= min)
if(strlen($text)>16) {
$text="Er: Textlength!"; // max 16 tekens.
}
if($br<0 || $br>127) $br=0; //helderheid tussen 0 en 127
$img = imagecreatefromjpeg($lcd); // handle voor display image
// PLED-keuren
switch ($cl) {
case "yellow":
$color =imagecolorallocatealpha($img,255,255,64,$br);
break;
case "red":
$color = imagecolorallocatealpha($img,255,64,64,$br);
break;
case "green":
$color = imagecolorallocatealpha($img,64,255,64,$br);
break;
case "blue":
$color = imagecolorallocatealpha($img, 0,255,255,$br);
break;
default: //white
$color = imagecolorallocatealpha($img,255,255,255,$br);
}
for ($e=0;$e<strlen($text);$e++){
$value = ord(substr($text,$e,1));
$char=$chars[$value];
$y=0;
foreach($char as $letter){
for ($bit=0;$bit<=strlen($letter);$bit++){
if (substr($letter,$bit,1)=="1"){
imagefilledrectangle ( $img,9+(($col*16)+(3*$bit)+1) ,9+ (3*$y), 10+(($col*16)+(3*$bit)+1) , 10+ (3*$y) ,$color );
}
}
$y++;
}
$col++;
}
imagejpeg($img,"",100);
imagedestroy($img);
?>
$chars = array(
32=> array("00000","00000","00000","00000","00000","00000","00000","00000"),
33=> array("00100","00100","00100","00100","00100","00000","00100","00000"),
34=> array("01010","01010","01010","00000","00000","00000","00000","00000"),
35=> array("01010","01010","11111","01010","11111","01010","01010","00000"),
36=> array("00100","01111","10100","01110","00101","11110","00100","00000"),
37=> array("11000","11001","00010","00100","01000","10011","00011","00000"),
38=> array("01100","10010","10100","01000","10101","10010","01101","00000"),
39=> array("01100","00100","01000","00000","00000","00000","00000","00000"),
40=> array("00010","00100","01000","01000","01000","00100","00010","00000"),
41=> array("01000","00100","00010","00010","00010","00100","01000","00000"),
42=> array("00000","00100","10101","01110","10101","00100","00000","00000"),
43=> array("00000","00100","00100","11111","00100","00100","00000","00000"),
44=> array("00000","00000","00000","00000","01100","00100","01000","00000"),
45=> array("00000","00000","00000","11111","00000","00000","00000","00000"),
46=> array("00000","00000","00000","00000","00000","01100","01100","00000"),
47=> array("00000","00001","00010","00100","01000","10000","00000","00000"),
48=> array("01110","10001","10011","10101","11001","10001","01110","00000"),
49=> array("00100","01100","00100","00100","00100","00100","11111","00000"),
50=> array("01110","10001","00001","00010","00100","01000","11111","00000"),
51=> array("11111","00010","00100","00010","00001","10001","01110","00000"),
52=> array("00010","00110","01010","10010","11111","00010","00010","00000"),
53=> array("11111","10000","11110","00001","00001","10001","01110","00000"),
54=> array("00110","01000","10000","11110","10001","10001","01110","00000"),
55=> array("11111","00001","00010","00100","01000","01000","01000","00000"),
56=> array("01110","10001","10001","01110","10001","10001","01110","00000"),
57=> array("01110","10001","10001","01111","00001","00010","01100","00000"),
58=> array("00000","01100","01100","00000","01100","01100","00000","00000"),
59=> array("00000","01100","01100","00000","01100","00100","01000","00000"),
60=> array("00010","00100","01000","10000","01000","00100","00010","00000"),
61=> array("00000","00000","11111","00000","11111","00000","00000","00000"),
62=> array("01000","00100","00010","00001","00010","00100","01000","00000"),
63=> array("01110","10001","00001","00010","00100","00000","00100","00000"),
64=> array("01110","10001","00001","01101","10101","10101","01110","00000"),
65=> array("01110","10001","10001","11111","10001","10001","10001","00000"),
66=> array("11110","10001","10001","11110","10001","10001","11110","00000"),
67=> array("01110","10001","10000","10000","10000","10001","01110","00000"),
68=> array("11110","10001","10001","10001","10001","10001","11110","00000"),
69=> array("11111","10000","10000","11110","10000","10000","11111","00000"),
70=> array("11111","10000","10000","11110","10000","10000","10000","00000"),
71=> array("01110","10001","10000","10111","10001","10001","01111","00000"),
72=> array("10001","10001","10001","11111","10001","10001","10001","00000"),
73=> array("01110","00100","00100","00100","00100","00100","01110","00000"),
74=> array("00111","00010","00010","00010","00010","10010","01100","00000"),
75=> array("10001","10010","10100","11000","10100","10010","10001","00000"),
76=> array("10000","10000","10000","10000","10000","10000","11111","00000"),
77=> array("10001","11011","10101","10001","10001","10001","10001","00000"),
78=> array("10001","10001","11001","10101","10011","10001","10001","00000"),
79=> array("01110","10001","10001","10001","10001","10001","01110","00000"),
80=> array("11110","10001","10001","11110","10000","10000","10000","00000"),
81=> array("01110","10001","10001","10001","10101","10010","01101","00000"),
82=> array("11110","10001","10001","11110","10100","10010","10001","00000"),
83=> array("01110","10001","10000","01110","00001","10001","01110","00000"),
84=> array("11111","00100","00100","00100","00100","00100","00100","00000"),
85=> array("10001","10001","10001","10001","10001","10001","01110","00000"),
86=> array("10001","10001","10001","10001","10001","01010","00100","00000"),
87=> array("10001","10001","10001","10001","10101","10101","01010","00000"),
88=> array("10001","10001","01010","00100","01010","10001","10001","00000"),
89=> array("10001","10001","01010","00100","00100","00100","00100","00000"),
90=> array("11111","00001","00010","00100","01000","10000","11111","00000"),
91=> array("01110","01000","01000","01000","01000","01000","01110","00000"),
92=> array("10001","01010","11111","00100","11111","00100","00100","00000"),
93=> array("01110","00010","00010","00010","00010","00010","01110","00000"),
94=> array("00100","01010","10001","00000","00000","00000","00000","00000"),
95=> array("00000","00000","00000","00000","00000","00000","11111","00000"),
96=> array("00100","00010","00000","00000","00000","00000","00000","00000"),
97=> array("00000","00000","01110","00001","01111","10001","01111","00000"),
98=> array("10000","10000","10110","11001","10001","10001","11110","00000"),
99=> array("00000","00000","01110","10000","10000","10001","01110","00000"),
100=> array("00001","00001","01101","10011","10001","10001","01111","00000"),
101=> array("00000","00000","01110","10001","11111","10000","01110","00000"),
102=> array("00110","01001","01000","11100","01000","01000","01000","00000"),
103=> array("00000","00000","01111","10001","10001","01111","00001","01110"),
104=> array("10000","10000","10110","11001","10001","10001","10001","00000"),
105=> array("00100","00000","01100","00100","00100","00100","01110","00000"),
106=> array("00010","00000","00110","00010","00010","00010","10010","01100"),
107=> array("10000","10000","10010","10100","11000","10100","10010","00000"),
108=> array("01100","00100","00100","00100","00100","00100","01110","00000"),
109=> array("00000","00000","11010","10101","10101","10001","10001","00000"),
110=> array("00000","00000","10110","11001","10001","10001","10001","00000"),
111=> array("00000","00000","01110","10001","10001","10001","01110","00000"),
112=> array("00000","00000","11110","10001","11110","10000","10000","00000"),
113=> array("00000","00000","01101","10011","01111","00001","00001","00000"),
114=> array("00000","00000","10110","11001","10000","10000","10000","00000"),
115=> array("00000","00000","01110","10000","01110","00001","11110","00000"),
116=> array("00000","01000","11110","01000","01000","01001","00110","00000"),
117=> array("00000","00000","10001","10001","10001","10011","01101","00000"),
118=> array("00000","00000","10001","10001","10001","01010","00100","00000"),
119=> array("00000","00000","10001","10001","10101","10101","01010","00000"),
120=> array("00000","00000","10001","01010","00100","01010","10001","00000"),
121=> array("00000","00000","10001","10001","10001","01111","00001","01110"),
122=> array("00000","00000","11111","00010","00100","01000","11111","00000"),
123=> array("00010","00100","00100","01000","00100","00100","00010","00000"),
124=> array("00100","00100","00100","00100","00100","00100","00100","00000"),
125=> array("01000","00100","00100","00010","00100","00100","01000","00000"),
);
header('content-type: image/jpeg');
$lcd = "display.jpg";
$col = 0; // x-positie (0-15)
// $_GET's : zelf beveiligen...
$text = $_GET["q"]; // tekst (max 16 chars)
$cl = $_GET['c']; // kleur
$br = $_GET['b']; // helderheid (0=max - 127= min)
if(strlen($text)>16) {
$text="Er: Textlength!"; // max 16 tekens.
}
if($br<0 || $br>127) $br=0; //helderheid tussen 0 en 127
$img = imagecreatefromjpeg($lcd); // handle voor display image
// PLED-keuren
switch ($cl) {
case "yellow":
$color =imagecolorallocatealpha($img,255,255,64,$br);
break;
case "red":
$color = imagecolorallocatealpha($img,255,64,64,$br);
break;
case "green":
$color = imagecolorallocatealpha($img,64,255,64,$br);
break;
case "blue":
$color = imagecolorallocatealpha($img, 0,255,255,$br);
break;
default: //white
$color = imagecolorallocatealpha($img,255,255,255,$br);
}
for ($e=0;$e<strlen($text);$e++){
$value = ord(substr($text,$e,1));
$char=$chars[$value];
$y=0;
foreach($char as $letter){
for ($bit=0;$bit<=strlen($letter);$bit++){
if (substr($letter,$bit,1)=="1"){
imagefilledrectangle ( $img,9+(($col*16)+(3*$bit)+1) ,9+ (3*$y), 10+(($col*16)+(3*$bit)+1) , 10+ (3*$y) ,$color );
}
}
$y++;
}
$col++;
}
imagejpeg($img,"",100);
imagedestroy($img);
?>