class ImageOptim::ImageMeta

Getting format of image at path or as data

Attributes

format[R]

Public Class Methods

for_data(data) click to toggle source
# File lib/image_optim/image_meta.rb, line 13
def self.for_data(data)
  is = ImageSize.new(data)
  new(is.format)
rescue ImageSize::FormatError => e
  warn "#{e} (detecting format of image data)"
end
for_path(path) click to toggle source
# File lib/image_optim/image_meta.rb, line 6
def self.for_path(path)
  is = ImageSize.path(path)
  new(is.format)
rescue ImageSize::FormatError => e
  warn "#{e} (detecting format of image at #{path})"
end
new(format) click to toggle source
# File lib/image_optim/image_meta.rb, line 21
def initialize(format)
  @format = format
end