Class: VideoThumbnailEncoder

Inherits:
Dragonfly::Encoding::RMagickEncoder
  • Object
show all
Defined in:
lib/noodall/video_thumbnail_encoder.rb

Instance Method Summary collapse

Instance Method Details

#encode(image, format, encoding = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/noodall/video_thumbnail_encoder.rb', line 5

def encode(image, format, encoding={})
  format = format.to_s.downcase
  throw :unable_to_handle unless supported_formats.include?(format.to_sym)
  encoded_image = rmagick_image(image, encoding[:offset])
  if encoded_image.format.downcase == format
    image # do nothing
  else
    encoded_image.format = format
    encoded_image.to_blob
  end
end