Sha256: f7c8956d77ea31676d17b1de68c42760733b9b8d63f52751ac073268c2f265c0

Contents?: true

Size: 1006 Bytes

Versions: 60

Compression:

Stored size: 1006 Bytes

Contents

module Dragonfly
  module ImageMagick
    class Encoder

      include Configurable
      include Utils

      configurable_attr :supported_formats, [
        :ai,
        :bmp,
        :eps,
        :gif,
        :gif87,
        :ico,
        :j2c,
        :jp2,
        :jpeg,
        :jpg,
        :pbm,
        :pcd,
        :pct,
        :pcx,
        :pdf,
        :pict,
        :pjpeg,
        :png,
        :png24,
        :png32,
        :png8,
        :pnm,
        :ppm,
        :ps,
        :psd,
        :ras,
        :tga,
        :tiff,
        :wbmp,
        :xbm,
        :xpm,
        :xwd
      ]

      def encode(temp_object, format, args='')
        format = format.to_s.downcase
        throw :unable_to_handle unless supported_formats.include?(format.to_sym)
        details = identify(temp_object)

        if details[:format] == format.to_sym && args.empty?
          temp_object
        else
          convert(temp_object, args, format)
        end
      end

    end
  end
end

Version data entries

60 entries across 60 versions & 3 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.7.4 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.7.3 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.7.2 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.7.1 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.7.0 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
dragonfly-0.9.15 lib/dragonfly/image_magick/encoder.rb
dragonfly-0.9.14 lib/dragonfly/image_magick/encoder.rb
dragonfly-0.9.13 lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.9 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.8 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.7 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.6 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.5 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.4 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.3 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.2 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.1 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.6.0 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb
classiccms-0.5.17 vendor/bundle/gems/dragonfly-0.9.12/lib/dragonfly/image_magick/encoder.rb