EXIF data imbedded in pic has an orientation code
Image viewers like iphone photos app read code and adjust if different than code 1
But, EXIF data can get stripped from pic when uploading to hosts
Then image viewers no longer automatically rotate
This problem happens to me when taking iphone pics in portrait orientation
Landscape (sideways) never give me problems
My method is using "old fashioned" windows freeware FastStone
Delete all EXIF data...then the portrait pics result in wrong rotation
So, then edit, rotate and save
Now doesn't matter if host strips EXIF or not
Added (primary) bonus of deleting EXIF data -- location privacy
There are many iphone EXIF apps for around $5
Can strip away data from batches with paid options
One kludgy workaround I discovered for free, just playing around today. Sounds similar to Stu's idea. If you take a portrait photo, edit it with iphone default photos app, rotate 90 degrees, press done. Then edit it again, rotate it three more times until right side up, then press done. Now, the EXIF orientation code is defeated, and even if EXIF gets stripped, pic will appear correct