Also, this should be conditional!  You don't need to rewrite the EXIF if the user did not rotate the image.