>>53532850kind of correct kind of not.
androids: always stored long side up, image rotation stored in exif.
rotate phone anti-clockwise 90deg, that is usually your stripped orientation. Some are the opposite.
iphone: good luck. raw orientations are different depending on camera, settings, and phone rotation.
obv 4channel strips exif so the raw orien is used.
you can correct portrait images simply by cropping them on phone or compressing them with a third party app