From 555b5cb055a189d59e5b66d539b905d8abbced6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Fri, 29 May 2015 10:58:27 +0200 Subject: [PATCH] FIX: optimized images were *not* optimized... (:fired:) --- app/models/optimized_image.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/models/optimized_image.rb b/app/models/optimized_image.rb index 4600af8e06f..8ef01c3d690 100644 --- a/app/models/optimized_image.rb +++ b/app/models/optimized_image.rb @@ -150,19 +150,24 @@ class OptimizedImage < ActiveRecord::Base method_name = "#{operation}_instructions" method_name += "_animated" if !!opts[:allow_animation] && from =~ /\.GIF$/i instructions = self.send(method_name.to_sym, from, to, dim, opts) - convert_with(instructions) + convert_with(instructions, to) end def self.dimensions(width, height) "#{width}x#{height}" end - def self.convert_with(instructions) + def self.convert_with(instructions, to) `convert #{instructions.join(" ")}` return false if $?.exitstatus != 0 - ImageOptim.new.optimize_image!(to) rescue nil + begin + ImageOptim.new.optimize_image!(to) + rescue => ex + Rails.logger.warn("Could not optimize image: #{to}") + end + true end