Class: DragonflyVideo::Processors::Screenshot

Inherits:
BaseProcessor show all
Defined in:
lib/dragonfly_video/processors/screenshot.rb

Constant Summary

Constants inherited from BaseProcessor

BaseProcessor::FFMPEG_COMMAND

Instance Method Summary collapse

Instance Method Details

#call(content, options = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/dragonfly_video/processors/screenshot.rb', line 8

def call(content, options = {})
  format = options.delete(:format) { :jpg }
  content.shell_update(ext: format) do |old_path, new_path|
    "#{FFMPEG_COMMAND} -y -i #{old_path} -vframes 1 #{new_path}"
  end
  content.ext = format.to_s
end

#update_url(attrs, options = {}) ⇒ Object



16
17
18
19
# File 'lib/dragonfly_video/processors/screenshot.rb', line 16

def update_url(attrs, options = {})
  format = options.fetch(:format, :jpg)
  attrs.ext = format.to_s
end