Sha256: 3b0bab1151fb2dc4c3d459d1a87aa2d25c01d9426c2b309a15afcb23dcb85460
Contents?: true
Size: 1.02 KB
Versions: 7
Compression:
Stored size: 1.02 KB
Contents
module PaperclipCompression class Jpeg < Base KEY = :jpeg JPEGTRAN_DEFAULT_OPTS = '-copy none -optimize -perfect' 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, "JPEGTRAN : There was an error processing #{@basename}" if @config.whiny rescue CommandNotFoundError raise Paperclip::Errors::CommandNotFoundError.new("Could not run 'jpegtran'. Please install jpegtran.") end end private def gem_defaults { command: command_path('jpegtran'), options: JPEGTRAN_DEFAULT_OPTS } end def compress Paperclip.run( @config.command, "#{@config.options} :src_path > :dst_path", src_path: @src_path, dst_path: @dst_path ) end end end
Version data entries
7 entries across 7 versions & 2 rubygems