Sha256: addfa95ae25660347458516d0c91052cb73888042a57d5fd966ff3da526ab53d

Contents?: true

Size: 417 Bytes

Versions: 16

Compression:

Stored size: 417 Bytes

Contents

require 'fastimage'

module LinkThumbnailer
  module ImageParsers
    class Type

      def self.perform(image)
        return unless perform?
        ::FastImage.type(image.src.to_s, raise_on_failure: true)
      rescue ::FastImage::FastImageException, ::Errno::ENAMETOOLONG
        nil
      end

      private

      def self.perform?
        ::LinkThumbnailer.page.config.image_stats
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
link_thumbnailer-3.0.1 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-3.0.0 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.6.1 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.6.0 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.5.2 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.5.1 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.5.0 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.4.0 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.3.2 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.3.1 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.3.0 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.2.3 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.2.2 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.2.1 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.2.0 lib/link_thumbnailer/image_parsers/type.rb
link_thumbnailer-2.1.0 lib/link_thumbnailer/image_parsers/type.rb