mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: optimized images were *not* optimized... (:fired:)
This commit is contained in:
parent
cb025a65e0
commit
555b5cb055
1 changed files with 8 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue