ADD: Rotate Image via EXIF Information

This commit is contained in:
HausdorffHimself
2013-09-13 01:44:07 +02:00
parent ca6858c0a0
commit be55462e35
2 changed files with 13 additions and 0 deletions

View File

@@ -30,7 +30,11 @@ class FotoUploader < CarrierWave::Uploader::Base
# def scale(width, height) # def scale(width, height)
# # do something # # do something
# end # end
# general settings
process :fix_exif_rotation
process :strip process :strip
process :convert => 'jpg'
# Create different versions of your uploaded files: # Create different versions of your uploaded files:
version :thumb do version :thumb do

View File

@@ -1,6 +1,15 @@
module CarrierWave module CarrierWave
module RMagick module RMagick
# Rotates the image based on the EXIF Orientation
def fix_exif_rotation
manipulate! do |img|
img.auto_orient!
img = yield(img) if block_given?
img
end
end
# Manipulates quality settings of image # Manipulates quality settings of image
def quality(percentage) def quality(percentage)
manipulate! do |img| manipulate! do |img|