Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2013
997
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. $img = imagecreatefromjpeg("map.jpg");
  4. $red = imagecolorallocate($img, 255, 0, 0);
  5.  
  6. if( isset($_GET["x"]) && isset($_GET["y"]) ) {
  7.   // the map is GTA SAn andreas is 6000x6000
  8.   // the image that i use is 800x800 6000/800 = 7.5
  9.  
  10.   $x = $_GET["x"]/7.5;
  11.   $y = $_GET["y"]/7.5;
  12.  
  13.   // 0.0 0.0 is at the center of the map, in PHP 0.0 0.0 is in the top left corner, so I added / substracted 400. the map is 800x800 px, 400x400 is at the center of the map.
  14.  
  15.   $x = $x + 400;
  16.   $y = -($y - 400);
  17.  
  18.   imagefilledrectangle($img, $x, $y, $x+10, $y + 10, $red);
  19. }
  20.  
  21. header ('Content-Type: image/png');
  22. imagepng($img);
  23. imagedestroy($img);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement