Sha256: dd2b25a6ebdb115fb33f398aa42ceb19073b42661c12f105a5ad3c1ac8e34f28

Contents?: true

Size: 495 Bytes

Versions: 14

Compression:

Stored size: 495 Bytes

Contents

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

14 entries across 14 versions & 2 rubygems

Version Path
image_optim-0.26.3 lib/image_optim/image_meta.rb
image_optim-0.26.2 lib/image_optim/image_meta.rb
discourse_image_optim-0.26.2 lib/image_optim/image_meta.rb
discourse_image_optim-0.26.1 lib/image_optim/image_meta.rb
image_optim-0.26.1 lib/image_optim/image_meta.rb
image_optim-0.26.0 lib/image_optim/image_meta.rb
image_optim-0.25.0 lib/image_optim/image_meta.rb
discourse_image_optim-0.24.5 lib/image_optim/image_meta.rb
image_optim-0.24.3 lib/image_optim/image_meta.rb
discourse_image_optim-0.24.4 lib/image_optim/image_meta.rb
image_optim-0.24.2 lib/image_optim/image_meta.rb
image_optim-0.24.1 lib/image_optim/image_meta.rb
image_optim-0.24.0 lib/image_optim/image_meta.rb
image_optim-0.23.0 lib/image_optim/image_meta.rb