Class: Wistia::Media

Inherits:
Base
  • Object
show all
Defined in:
lib/wistia/media.rb

Instance Method Summary (collapse)

Methods inherited from Base

refresh_config!, #to_json

Instance Method Details

- (Object) still(width = 640, options = {})



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/wistia/media.rb', line 6

def still(width = 640, options = {})
  options = {:format => 'jpg', :style => 'image_resize'}.merge(options)
  matcher = self.type == 'Image' ? /OriginalFile/ : /StillImage/
  self.assets.each do |asset|
    if asset.type.match(matcher)
      url = asset.url.gsub(/\.bin$/, ".#{options[:format]}?#{options[:style]}=#{width}")
      return url
    end
  end
  return nil
end