I have an image which appears upright when you use a browser to navigate to its URL
, but is rotated 90 degrees when I do something like this <img id='img' src=URL>
. I don't want it to be rotated. Actually, I have a whole list of images, and some are rotated while most aren't. The URLs don't give me any clue as to which it's going to be.
I understand the issue is something to do with EXIF. I'm not sure if either:
a) The EXIF image rotation property is being accounted for. Therefore I'd want to ignore it using CSS
or
b) The EXIF image rotation property is not being accounted for. Therefore I'd want to use CSS to tell the browser that it should account for it.
The best solutions I've found use exif-js to check the image rotation property, then based off that CSS to correct the rotation. But unfortunately, I can't use JS in this example. I need to do it within the tag with the style parameter.
Context: I'm using WiX, a serverless website builder. It lets me set the html of a text element. So I'm taking advantage of that to show images in a more custom way than WiX would normally let me.
Edit: Other answers have also mentioned image-orientation: from-image
but most browsers don't support this.