handle orientation of images