img tag displays wrong orientation

前端 未结 14 1492
夕颜
夕颜 2020-11-27 12:11

I have an image at this link: http://d38daqc8ucuvuv.cloudfront.net/avatars/216/2014-02-19%2017.13.48.jpg

As you can see, this is a normal image with correct orientat

14条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-27 12:49

    I found part of the solution. Images now have metadata that specify the orientation of the photo. There is a new CSS spec for image-orientation.

    Just add this to your CSS:

    img {
        image-orientation: from-image;
    }
    

    According to the spec as of Jan 25 2016, Firefox and iOS Safari (behind a prefix) are the only browsers that support this. I'm seeing issues with Safari and Chrome still. However, mobile Safari seems to natively support orientation without the CSS tag.

    I suppose we'll have to wait and see if browsers wills start supporting image-orientation.

提交回复
热议问题