Sha256: 127cf697117c967a4a7746db7be836e9a4471c4b4216f25f07f0146ccfcc8260

Contents?: true

Size: 526 Bytes

Versions: 12

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

require 'image_size'

class ImageOptim
  # Getting format of image at path or as data
  module ImageMeta
    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

    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
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
image_optim-0.31.4 lib/image_optim/image_meta.rb
image_optim-0.31.3 lib/image_optim/image_meta.rb
image_optim-0.31.2 lib/image_optim/image_meta.rb
image_optim-0.31.1 lib/image_optim/image_meta.rb
image_optim-0.31.0 lib/image_optim/image_meta.rb
image_optim-0.30.0 lib/image_optim/image_meta.rb
image_optim-0.29.0 lib/image_optim/image_meta.rb
image_optim-0.28.0 lib/image_optim/image_meta.rb
image_optim-0.27.1 lib/image_optim/image_meta.rb
image_optim-0.27.0 lib/image_optim/image_meta.rb
image_optim-0.26.5 lib/image_optim/image_meta.rb
image_optim-0.26.4 lib/image_optim/image_meta.rb