Jump to content

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/84817-php-gd-wrap-around/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.