in Web & Tech

Make CarrierWave respect Exif orientation

# config/initializers/carrierwave_initializer.rb
module CarrierWave
  module RMagick
    # Rotates the image based on the EXIF Orientation
    def fix_exif_rotation
      manipulate! do |img|
        img = yield(img) if block_given?

With this initializer we can add process :fix_exif_rotation to our uploader model.

Found in this great blog post by Mario Visic, which, by the way, also shows how to change jpeg quality.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Learn More)

  • Related Content by Tag