Read more

Carrierwave: Auto-rotate tagged JPEGs

Tobias Kraze
November 09, 2012Software engineer at makandra GmbH

Modern cameras often produce JPEGs that have a "I should be rotated 90° to the left" flag. If you process such pictures using Carrierwave this will be ignored and you'll end up with a wrongly rotated image.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

Fortunately, this is easy to fix:

In your Uploader, add

process :auto_orient # this should go before all other "process" steps

def auto_orient
  manipulate! do |image|
    image.tap(&:auto_orient)
  end
end

Note: You can add the process :auto_orient outside of all your version blocks and it will apply to all of them.

Posted by Tobias Kraze to makandra dev (2012-11-09 10:49)