vijaykumarkakatkar Posted July 13, 2008 Share Posted July 13, 2008 i have used following code to fill rectangular shape on an image with inputs as x and y coordinates. Now my problem is how to give link to the specified coordinates wherein i want to pop up a user info form. Here is my code : <? // These are the coordinates the location we wish to plot.<br> // These are being passed in the URL, but we will set them to a // default if nothing is passed. // First we load the background/base map. We assume it's located in same dir // as the script. // This can be any format but we are using JPG in this example // We will also allocate the color for the marker $im = imagecreatefromjpeg("layout.jpg"); $red = imagecolorallocate ($im, 255,0,0); // Next need to find the base image size. // We need these variables to be able scale the long/lat coordinates. $scale_x = imagesx($im); $scale_y = imagesy($im); $pt = getlocationcoords(293, 183, 1000, 1000); // Now mark the point on the map using a red 4 pixel rectangle imagefilledrectangle($im,$pt["x"]-25,$pt["y"]-25,$pt["x"]+25,$pt["y"]+25,$red); imagestring($im,2,1,$scale_y-20,"Courtesy of www.staycanada.ca",$red); // Return the map image. We are using a PNG format as it gives better final image quality than a JPG header("Content-Type: image/png"); imagepng($im); imagedestroy($im); function getlocationcoords($lat, $lon, $width, $height) { $x = $lat; $y = $lon; return array("x"=>round($x),"y"=>round($y)); } // Now we convert the long/lat coordinates into screen coordinates ?> If anyone could help me out with a script, an example or tutorial or any insight would be superb!!! Link to comment https://forums.phpfreaks.com/topic/114508-working-with-image-coordinates-and-giving-hotlinks/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.