iosruby-on-railsrubydragonfly-gem

Why do iphone images have the wrong orientation?


Our ruby/rails web app supports taking images using mobile devices. However, when taking an image using an iphone the orientation in the web view is sideways when viewed through [android, windows, mac]. When viewed through an iphone, the image has the correct orientation. If I download the image and open it in chrome it has the correct orientation.

We use dragonfly for image viewing. I am leaning towards this being the route cause... Any ideas?

%input{:accept => "image/*", :name => "image", :capture => "camera", :type => "file", :style =>'display:none;', :id => 'take_pic_master_btn'}

Solution

  • Are you using auto_orient?

    class Picture < ActiveRecord::Base
      extend Dragonfly::Model
    
      dragonfly_accessor :image do
        after_assign do |attachment|
          # Auto orien
          attachment.convert! '-auto-orient'
        end
      end
    end
    

    This is on "playback" but you could use this before save as well.