Report abuse

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
<?php





    function randLetter($letters){



        return $letters[array_rand($letters,1)];



    }



    error_reporting(0);

    define("IMAGE_BASE","..");



    $random = rand();



    include_once IMAGE_BASE.DIRECTORY_SEPARATOR."image/image.inc.php";



    $a = $_GET['a'];

    $b = $_GET['b'];

    $c = $_GET['c'];



    $tileServer = randLetter(array('a','b','c'));

    $tileFile = "/tmp/tile-$a-$b-$c.png";

    $uri = "http://$tileServer.tile.openstreetmap.org/$a/$b/$c.png";

    if(!file_exists($tileFile) ||

        filectime($tileFile) < time()-60*60){

        unlink($tileFile);

        $data = file_get_contents($uri);

        file_put_contents($tileFile,$data);

    }else{

        $data = file_get_contents($tileFile);

    }



    $tileServer = randLetter(array('a','b','c','d','e','f'));

    $lintFile = "/tmp/lint-$a-$b-$c.png";

    $uri = "http://$tileServer.tah.openstreetmap.org/Tiles/maplint/$a/$b/$c.png";

    if(!file_exists($lintFile) ||

        filectime($lintFile) < time()-60*60){

        unlink($lintFile);

        $data = file_get_contents($uri);

        file_put_contents($lintFile,$data);

    }else{

        $data = file_get_contents($lintFile);

    }





    $tile = imagecreatefrompng($tileFile);

    if(md5($data) != 'c549a1014b0bac4e7625e606c9b53e47'){

        $lint = imagecreateFrompng($lintFile);

        imagealphablending($img, true); 



        imagecopy($tile,$lint,0,0,0,0,256,256);

    }

    header('Content-Type:image/png');

    imagepng($tile);