Sha256: 0c708bf81665b73f276efe0b81253aebedfc8a6bbe18c44d1701bb1a4822d51c

Contents?: true

Size: 444 Bytes

Versions: 2

Compression:

Stored size: 444 Bytes

Contents

module Paperclip
  # Compresses the JPEG and PNG files
  class Compression < Processor

    def make
      case @attachment.content_type
      when 'image/jpeg' then make_jpeg
      when 'image/png'  then make_png
      else
        @file
      end
    end

    private

    def make_jpeg
      PaperclipCompression::Jpeg.make(@file, @options)
    end

    def make_png
      PaperclipCompression::Png.make(@file, @options)
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paperclip-compression-0.3.1 lib/paperclip-compression/paperclip/compression.rb
paperclip-compression-0.3.0 lib/paperclip-compression/paperclip/compression.rb