Jump to content

php gd wrap around


woody79

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.