FIX: thumbnail size reduced by stripping all EXIF information

This commit is contained in:
HausdorffHimself
2013-09-13 01:36:04 +02:00
parent e54c026fee
commit ca6858c0a0
2 changed files with 15 additions and 2 deletions

View File

@@ -30,16 +30,19 @@ class FotoUploader < CarrierWave::Uploader::Base
# def scale(width, height) # def scale(width, height)
# # do something # # do something
# end # end
process :strip
# Create different versions of your uploaded files: # Create different versions of your uploaded files:
version :thumb do version :thumb do
process :resize_to_fill => [64, 64] process :resize_to_fill => [64, 64]
process :quality => 30 process :quality => 70
end end
version :big_thumb do version :big_thumb do
process :resize_to_fill => [128, 128] process :resize_to_fill => [128, 128]
process :quality => 30 process :quality => 70
end end
version :resized do version :resized do
process :resize_to_fit => [1024, 1024] process :resize_to_fit => [1024, 1024]
end end

View File

@@ -1,6 +1,7 @@
module CarrierWave module CarrierWave
module RMagick module RMagick
# Manipulates quality settings of image
def quality(percentage) def quality(percentage)
manipulate! do |img| manipulate! do |img|
img.write(current_path){ self.quality = percentage } unless img.quality == percentage img.write(current_path){ self.quality = percentage } unless img.quality == percentage
@@ -9,5 +10,14 @@ module CarrierWave
end end
end end
# Strips out all EXIF information
def strip
manipulate! do |img|
img.strip!
img = yield(img) if block_given?
img
end
end
end end
end end