Sha256: 592dc420b39cacbc341724d8d36d4df4ad30a5be77f752019ad939a681683991
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
module PaperclipCompression class Png < Base KEY = :png OPTIPNG_DEFAULT_OPTS = '-o 5 -quiet' def initialize(file, first_processor, options = {}) super(file, first_processor) @config = PaperclipCompression::Config.create_with_fallbacks(options, KEY, gem_defaults) end def make begin @config.process_file? ? process_file : unprocessed_tempfile rescue ExitStatusError raise Paperclip::Error, "OPTIPNG : There was an error processing #{@basename}" if @config.whiny rescue CommandNotFoundError raise Paperclip::Errors::CommandNotFoundError.new("Could not run 'optipng'. Please install optipng.") end end private def gem_defaults { command: command_path('optipng'), options: OPTIPNG_DEFAULT_OPTS } end def compress Paperclip.run( @config.command, "#{@config.options} -clobber :src_path -out :dst_path", src_path: @src_path, dst_path: @dst_path ) end end end
Version data entries
7 entries across 7 versions & 2 rubygems