Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
<?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);
This paste will be private.
From the Design Piracy series on my blog: