Process EXIF rotation information for uploaded images
When taking the picture via iphone in portrait mode, it uses EXIF to handle rotations. So in the preview mode it looks ok, but after uploading and redownloading the image is stripped of these information and shown in the incorrect rotation settings.
There should be library to handle this. I would not suggest trying to solve this from scratch as there are too many scenarios.
Open Navigator on the iphone.
Go to your Personal information.
Tap to change your picture and take a new picture in the potrait mode, upload and save.
Refresh the page and see the picture to be rotated by 90 degrees.