Module: ImageOptim::ImageMeta

Defined in:
lib/image_optim/image_meta.rb

Overview

Getting format of image at path or as data

Class Method Summary collapse

Class Method Details

.format_for_data(data) ⇒ Object



13
14
15
16
17
18
# File 'lib/image_optim/image_meta.rb', line 13

def self.format_for_data(data)
  is = ImageSize.new(data)
  is.format if is
rescue ImageSize::FormatError => e
  warn "#{e} (detecting format of image data)"
end

.format_for_path(path) ⇒ Object



6
7
8
9
10
11
# File 'lib/image_optim/image_meta.rb', line 6

def self.format_for_path(path)
  is = ImageSize.path(path)
  is.format if is
rescue ImageSize::FormatError => e
  warn "#{e} (detecting format of image at #{path})"
end