Skip to content

Commit

Permalink
better handling of animated input files
Browse files Browse the repository at this point in the history
  • Loading branch information
netskin-ci committed Nov 22, 2010
1 parent 9304e16 commit 89df2ae
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/sequel_paperclip/processors/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,29 @@ def run(style, style_options, dst_file)

cmd = []
cmd << "convert"

cmd << "-resize"
cmd << "'#{resize_str}'"

if crop_str
cmd << "-crop"
cmd << "'#{crop_str}'"
end

if options[:convert_arguments]
cmd << options[:convert_arguments]
end
cmd << @src_path
cmd << "#{style_options[:format]}:#{dst_file.path}"

case style_options[:format]
when :gif, :apng
cmd << "'#{@src_path}'"
else
# extract first frame only (works even when input is non-animated)
cmd << "'#{@src_path}[0]'"
end

cmd << "'#{style_options[:format]}:#{dst_file.path}'"

`#{cmd*" "}`
end

Expand Down

0 comments on commit 89df2ae

Please sign in to comment.