Crop using coordinates

See all posts Reply

Crop using coordinates  new!
by Frank, 16 years, 2 months ago
Hello

Thanks for a wonderful script! I am trying to use a javascript imagearea script to crop, and the javascript are using x1, y1, x2, y2. Can somebody please help me out with some directions or code snippet. I have managed to crop it, but it's not correct.Reply
Re: Crop using coordinates  new!
by colin, 16 years, 2 months ago
Re: Crop using coordinates  new!
by Frank, 16 years, 2 months ago
Hi Colin

Well I have tested this one, but I get this error:

Fatal error: Call to undefined method upload::image_crop() in C:\xampp\htdocs\index.php on line 114

Is there something I miss here?Reply
Re: Crop using coordinates  new!
by colin, 16 years, 2 months ago
Sorry, there was a bug in the code I linked to. The correct code is:
if ($handle->uploaded) {
  if ($handle->file_is_image) {
    $handle->image_convert = 'jpg';
    $handle->image_crop = array($y1, $handle->image_src_x - $x2, $handle->image_src_y - $y2, $x1);
    $handle->process('/my/dir/');
  }
}
Reply
Re: Crop using coordinates  new!
by Frank, 16 years, 2 months ago
Hi

I found out that it was missing = array, and I just now wanted to post it here, but you beet me to it!

Thanks! It works like a charm!Reply