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 See thread Reply
$foo->image_crop = '100 500 250 100';
We have a picture with dimensions of 800px/600px.
Let's get point A of with coordinates X:100px, y:100px
Let's get point B of with coordinates X:300px, y:350px
How to crop an imagr from point A to point B.
Example to wxplanation:
http://img171.imageshack.us/img171/4953/croping.jpg
For instance, in your example:
Note that you can use $foo->image_x and $foo->image_src_x to determine your margins, etc...