roofrauf Posted April 11, 2011 Share Posted April 11, 2011 I am using this script (which is from http://www.web-max.ca/PHP/) function getlocationcoords($lat, $lon, $width, $height) { $x = (($lon + 155.4) * ($width / 360)); $y = ((($lat * -1) + 123) * ($height / 180)); return array("x"=>round($x),"y"=>round($y)); } // These are the coordinates the location we wish to plot. // These are being passed in the URL, but we will set them to a default if nothing is passed. if(empty($long))$long = [i]longgoeshere [/i]; if(empty($lat)) $lat = [i]latgoeshere[/i]; // 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 = imagecreatefrompng("[i]imagegoeshere[/i]"); $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); // Now we convert the long/lat coordinates into screen coordinates $pt = getlocationcoords($lat, $long, $scale_x, $scale_y); // Now mark the point on the map using a red 4 pixel rectangle imagefilledrectangle($im,$pt["x"]-.1,$pt["y"]-.1,$pt["x"]+.1,$pt["y"]+.1,$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); imagefilledrectangle($im,$pt["x"]-.1,$pt["y"]-.1,$pt["x"]+.1,$pt["y"]+.1,$red) ^^ This is the line that I want to change...I want to replace the rectangle with an actual image that will still plot at the coordinates calculated earlier in the script. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/233311-changing-imagefilledrectangle-to-an-actual-image/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.