imagecopyresampled not working 100%

HI All!

I have a question about the funtion imagecopyresampled. I have a big image ($src) that i will crop and that use imagecopyresampled to create the new (cropped) image. (always 980 x 435)
But when I give the following parameters I get an image which is always cropped from the left upper corner where crop_x and crop_y are zero. Why is this?

Thanks in advance!!

Parameters:
$dst_r = ImageCreateTrueColor( 908, 435 );
$img_r = imagecreatefromjpeg($src);
$_SESSION[‘crop_x’] = 36
$_SESSION[‘crop_y’] = 53
$targ_w =980
$targ_h = 435
$_SESSION[‘crop_w’] = 410
$_SESSION[‘crop_h’] = 182

imagecopyresampled(
$dst_r,
$img_r,
0,
0,
$_SESSION[‘crop_x’],
$_SESSION[‘crop_y’],
$targ_w,
$targ_h,
$_SESSION[‘crop_w’],
$_SESSION[‘crop_h’]);

Hello,

You appear to have a duplicate topic of this nature in the general php section. Please only post your topic once and only in one section. That way contributors will be able to follow one and only one post.

Post Locked!

Sponsor our Newsletter | Privacy Policy | Terms of Service