Getting the orientation and rotating the image properly