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



15
16
17
18
19
20
# File 'lib/image_optim/image_meta.rb', line 15

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



8
9
10
11
12
13
# File 'lib/image_optim/image_meta.rb', line 8

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