Function for cropping an image to a rectangle, use it to crop images uploaded via nicedit and save a copy of that as well