ds111 Posted June 13, 2009 Share Posted June 13, 2009 Hello! I am confused on how to use imagecopyresampled with a cropper and image resizer. I use jCrop (a jquery cropping plugin) and my own built resizing utility using the jquery slider. I have the following values: $x => The x-coord of the cropping field $y => The y-coord " " " " $s => The side of the cropping field (it's a square) $reg_w => The regular width of the image $reg_h => The regular height of the image $edit_w => The resized width of the image $edit_h => The resized height of the image I'm a bit confused on which values to put for the imagecopyresized() function. Please don't link to the PHP.net website detailing that function, as I've already spent the past 3 days trying to come up with the solution. Basically, the problem is that when I select the area to crop, it doesn't crop that area -- it crops something else, a bit below and to the side. I'm positive the X and Y coords are correct, I've already tested them. Any other ideas? Thanks! Link to comment https://forums.phpfreaks.com/topic/162073-image-crop-and-resize-with-imagecopyresampled/ Share on other sites More sharing options...
rhodesa Posted June 13, 2009 Share Posted June 13, 2009 The arguments for the function are as follows: $dst_image : Destination image link resource...the size of this image should be $s by $s $src_image : Source image link resource $dst_x : 0 $dst_y : 0 $src_x : $x $src_y : $y $dst_w : $s $dst_h : $s $src_w : $x + $s $src_h : $y + $s does that help? Link to comment https://forums.phpfreaks.com/topic/162073-image-crop-and-resize-with-imagecopyresampled/#findComment-855240 Share on other sites More sharing options...
ds111 Posted June 13, 2009 Author Share Posted June 13, 2009 Hmm, no not quite. I've set up a free DynDNS thing so you can test it out: http://jcropper.selfip.com I've tweaked the script so that it uses your calculations. Link to comment https://forums.phpfreaks.com/topic/162073-image-crop-and-resize-with-imagecopyresampled/#findComment-855268 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.