Automagically correct the orientation of images uploaded from mobile devices