aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage
diff options
context:
space:
mode:
authorGeorge Claghorn <george@basecamp.com>2017-12-11 18:32:05 -0500
committerGeorge Claghorn <george@basecamp.com>2017-12-11 18:32:14 -0500
commit6129d1f937c64eadd6118a89fea556b201b6b4d4 (patch)
tree37cb0c56fbb8598dd3bedcc3d2324a5d6a7551f8 /activestorage
parent931fe37aa78b9af9f779ac750cf2fa132e049c2b (diff)
downloadrails-6129d1f937c64eadd6118a89fea556b201b6b4d4.tar.gz
rails-6129d1f937c64eadd6118a89fea556b201b6b4d4.tar.bz2
rails-6129d1f937c64eadd6118a89fea556b201b6b4d4.zip
Fix optimizing GIF variants using mogrify's -layers option
Diffstat (limited to 'activestorage')
-rw-r--r--activestorage/app/models/active_storage/variation.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/activestorage/app/models/active_storage/variation.rb b/activestorage/app/models/active_storage/variation.rb
index 13bad87cac..fc4305dcc5 100644
--- a/activestorage/app/models/active_storage/variation.rb
+++ b/activestorage/app/models/active_storage/variation.rb
@@ -46,11 +46,13 @@ class ActiveStorage::Variation
# Accepts an open MiniMagick image instance, like what's returned by <tt>MiniMagick::Image.read(io)</tt>,
# and performs the +transformations+ against it. The transformed image instance is then returned.
def transform(image)
- transformations.each do |(method, argument)|
- if eligible_argument?(argument)
- image.public_send(method, argument)
- else
- image.public_send(method)
+ transformations.each do |method, argument|
+ image.mogrify do |command|
+ if eligible_argument?(argument)
+ command.public_send(method, argument)
+ else
+ command.public_send(method)
+ end
end
end
end