ADD: quality-process added to FotoUploader

This commit is contained in:
HausdorffHimself
2013-09-12 03:07:52 +02:00
parent 17d2241100
commit a2e1b9d55b
2 changed files with 16 additions and 0 deletions

View File

@@ -34,9 +34,11 @@ class FotoUploader < CarrierWave::Uploader::Base
# Create different versions of your uploaded files:
version :thumb do
process :resize_to_fill => [64, 64]
process :quality => 30
end
version :big_thumb do
process :resize_to_fill => [128, 128]
process :quality => 30
end
version :resized do
process :resize_to_fit => [1024, 1024]
@@ -53,4 +55,5 @@ class FotoUploader < CarrierWave::Uploader::Base
# "something.jpg" if original_filename
# end
end

View File

@@ -0,0 +1,13 @@
module CarrierWave
module RMagick
def quality(percentage)
manipulate! do |img|
img.write(current_path){ self.quality = percentage } unless img.quality == percentage
img = yield(img) if block_given?
img
end
end
end
end