exif image rotation issue using carrierwave and rmagick to upload to s3

前端 未结 4 1666
自闭症患者
自闭症患者 2020-11-30 03:36

I\'ve got a photo upload feature in my rails app. The app uploads direct to s3 through carrierwave via rmagick and fog. The issue I am having is when a photo is uploaded via

4条回答
  •  星月不相逢
    2020-11-30 03:36

    Lando2319's answer was not working for me.

    I am using RMagick.

    I managed to make ImageMagick apply the correct orientation (and to reset the EXIF rotation data in order to avoid a double rotation by the viewer) by using :

    def fix_exif_rotation # put this before any other process in the Carrierwave uploader
    
    manipulate! do |img|
      img.tap(&:auto_orient!)
    end
    

    The difference between my solution & Lando's is the bang (!). In my case it was absolutely necessary.

提交回复
热议问题