By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,722 Members | 1,904 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,722 IT Pros & Developers. It's quick & easy.

PHP: imagecopy problem

P: n/a
Hey all,

I'm trying to use imagecopy for creating a JPEG which is a part of the
original picture.
The problem is that when I give the width, height, X and Y it creates
an image which isn't the part i like to crop.
Here is the code:

function crop_jpeg_image($x1,$y1,$w,$h,$image,$quality=95){
$srcImage=imagecreatefromjpeg($image);
if($srcImage==''){
return FALSE;
}

$destImage=imagecreatetruecolor($w,$h);

imagecopy($destImage,$srcImage,0,0,$x1,$y1,$w,$h);

if(!imagejpeg($destImage,$image,$quality)){
return FALSE;
}

imagedestroy($destImage);
imagedestroy($srcImage);

return TRUE;
}

Is there anyone who can explain me what the problem can be?

Thanks in advance,

Lucas.

Feb 15 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.