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
$image_width = '600'; $image_height = '200'; $source_x = (int)$_POST['source_x']; $source_y = (int)$_POST['source_y']; $src = imagecreatefromjpeg('current_image.jpg'); $dest = imagecreatetruecolor($image_width, $image_height); imagecopy($dest, $src, 0, 0, $source_x, $source_y, $image_width, $image_height);
$foo->image_resize = true; $foo->image_x = $image_width; $foo->image_y = $image_height;
$foo->image_ratio_crop = true;
With this class how do I crop current image according to new $source_x & $source_y?
If you want to keep aspect ratio, and remove extra parts of the image that don't fit, you can add:
Here and example http://jsfiddle.net/83qFW/
I want to keep the $image_width & $image_height but just want to crop it by new $source_x & $source_y
You can use image_precrop for that. See this thread.
If you really want to buy me a coffee, there is a way here!