woody79 Posted January 7, 2008 Share Posted January 7, 2008 I have this world map(attached) that php loads and crops it down to 320x240 and the x and y coordinates can be changed. When the x or y coordinates go out side the picture i would like it to wrap around. at the moment i am only concentratring on the x coordinate. i can't get the wrap around part to work correctly. Help would be greatly appreciated. map.php <?php // The file $filename = 'world32k.jpg'; $percent = 0.5; // Content type header('Content-type: image/jpeg'); //create $image_p = imagecreatetruecolor(320, 240); $image_q = imagecreatetruecolor(320, 240); $white = imagecolorallocate($image_q, 255, 255, 255); imagefill($image_q, 0, 0, $white); $image = imagecreatefromjpeg($filename); //mask var list($width, $height) = getimagesize($filename); $x = 1100; $y = 350; if(($width-($x+320)) < 0) { imagecopyresampled($image_p, $image, 0, 0, $x, $y, 320, 240, 320, 240); imagecopyresampled($image_q, $image, 0, 0, (($width-($x+320))*2), $y, 320, 240, 320, 240); imagecopymerge($image_p, $image_q, 110, 0, 0, 0, 320, 240, 100); //imagejpeg($image_p, null, 100); imagejpeg($image_p, null, 100); } //mask //imagecopyresampled($image_p, $image, 0, 0, 1100, 350, 320, 240, 320, 240); // Output //imagejpeg($image_p, null, 100); ?> [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/84817-php-gd-wrap-around/ 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.