upload images and create thumbnails with automated cropping in PHP