Sha256: 33b446d5bcc06f741085d2a725c0a77bfa2ebd2a9e733f48ea41e2221c5fdc9c

Contents?: true

Size: 569 Bytes

Versions: 1

Compression:

Stored size: 569 Bytes

Contents

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

    def make
      case 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

    def content_type
      @file.is_a?(Paperclip::UploadedFileAdapter) ? @file.content_type : ImageSpec.new(@file).content_type
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
paperclip-compression-0.3.3 lib/paperclip-compression/paperclip/compression.rb