Jump to content

Image Crop and Resize with imagecopyresampled


ds111

Recommended Posts

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!

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?

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.