fix missing bold for your account item
[brisk.git] / web / suprend.php
1 <?php
2 if (isset($_GET['comp']) == FALSE)
3     exit;
4
5 if (isset($_GET['sfx']) && $_GET['sfx'] == '_side') {
6     $is_side = TRUE;
7 }
8 else {
9     $is_side = FALSE;
10 }
11
12
13 $comps = $_GET['comp'];
14
15 $c = array();
16
17 if (mb_strlen($comps, "ASCII") != 12)
18     exit;
19
20 for ($i = 0, $idx = 0 ; $i < 12 ; $i++) {
21     if (($comps[$i] >= '0' && $comps[$i] <= '9') ||
22         ($comps[$i] >= 'a' && $comps[$i] <= 'f')) {
23         if (($i % 2) == 1) {
24             $c[$idx] = hexdec(substr($comps, $i-1, 2));
25             $idx++;
26         }
27         continue;
28     }
29     exit;
30 }
31
32 header ('Content-type: image/png');
33 if ($is_side == TRUE) {
34     $img_r = @imagecreatefrompng("img/sup_msk_side_r.png");
35     $img_y = @imagecreatefrompng("img/sup_msk_side_y.png");
36 }
37 else {
38     $img_r = @imagecreatefrompng("img/sup_msk_r.png");
39     $img_y = @imagecreatefrompng("img/sup_msk_y.png");
40 }
41
42 $ret = imagefilter($img_r, IMG_FILTER_COLORIZE, $c[0], $c[1], $c[2], 0);
43 $ret = imagefilter($img_y, IMG_FILTER_COLORIZE, $c[3], $c[4], $c[5], 0);
44
45 if ($is_side == TRUE)
46     imagecopy($img_r, $img_y, 0,0, 0,0, 6, 16);
47 else
48     imagecopy($img_r, $img_y, 0,0, 0,0, 21, 16);
49
50 imagesavealpha($img_r, TRUE);
51
52 imagepng($img_r);
53 ?>