Hi,
I have the following code
$w=$_GET['w'];
$h=isset($_GET['h'])?$_GET['h']:$w;
$x=isset($_GET['x'])?$_GET['x']:0;
$y=isset($_GET['y'])?$_GET['y']:0;
$filename=$_GET['src'];
header('Content-type: image/jpg');
header('Content-Disposition: attachment; filename='.$src);
$image = imagecreatefromjpeg($filename);
$crop = imagecreatetruecolor($w,$h);
imagecopy ( $crop, $image, 0, 0, $x, $y, $w, $h );
imagejpeg($crop);
And display it as such
<img src="crop.php?x=<?php echo $_GET['x1']; ?>&y=<?php echo $_GET['y1']; ?>&w=300&h=300&src=cropper/castle.jpg">
So say the image is 500 x 333, it crops out a 300x300 section of it from X and Y. Works fine.
BUT, when i resize the image to say 450 x 300, it obviously still crops it from the 500 x 333 version so it looks different to what it should do.
I need a way to be able to resize the image in the above PHP and then imagecopy from that.
Cant think of how that would be done, any ideas?
Thank you!