class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
See all posts Reply
$handle = new upload($fname_original); if ($handle->uploaded) { //Get the new coordinates to crop the image. $x1 = $_POST["x1"]; $y1 = $_POST["y1"]; $x2 = $_POST["x2"]; $y2 = $_POST["y2"]; $w = $_POST["w"]; $h = $_POST["h"]; $handle->mime_check = true; $handle->allowed = array('image/*'); $handle->forbidden = array('application/*'); $handle->file_new_name_body = 'imagen_proy'; $handle->image_resize = true; $handle->image_x = 470; $handle->image_y = 470; $handle->image_precrop = array($y1, $handle->image_src_x - $x2, $handle->image_src_y - $y2, $x1); $handle->process($dir_pics); //thumbnail $handle->file_new_name_body = 'thhimagen_proy'; $handle->image_resize = true; $handle->image_ratio_x = true; $handle->image_y = 400; $handle->image_precrop = array($y1, $handle->image_src_x - $x2, $handle->image_src_y - $y2, $x1); $handle->process($dir_pics); $handle->clean(); } else { echo 'error : ' . $handle->error; }
$srcx = $handle->image_src_x; $srcy = $handle->image_src_y; $handle->image_precrop = array($y1, $srcx - $x2, $srcy - $y2, $x1);
I just want an image like the fist one, but diferent resizing: must be max y= 400
Thank you!
This way, is correct.
Without these lines, the second time cropping, the image_src_x and image_src_y, what not like first time.