Sha256: 6cf60e68a207b42107420e456bdc760667a0a8f26ef1aa3d24ba757025fa8fed
Contents?: true
Size: 949 Bytes
Versions: 2
Compression:
Stored size: 949 Bytes
Contents
module PaperclipCompression class Jpeg < Base JPEGTRAN_DEFAULT_OPTS = '-copy none -optimize -perfect' def initialize(file, first_processor, options = {}) super(file, first_processor, options) @cli_opts = init_cli_opts(:jpeg, default_opts) end def make begin process_file? ? process_file : unprocessed_tempfile rescue Cocaine::ExitStatusError => e raise Paperclip::Error, "JPEGTRAN : There was an error processing #{@basename}" if @whiny rescue Cocaine::CommandNotFoundError => e raise Paperclip::Errors::CommandNotFoundError.new("Could not run 'jpegtran'. Please install jpegtran.") end end private def default_opts JPEGTRAN_DEFAULT_OPTS end def compress Paperclip.run(command_path('jpegtran'), "#{@cli_opts} :src_path > :dst_path", src_path: @src_path, dst_path: @dst_path) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
paperclip-compression-0.3.16 | lib/paperclip-compression/jpeg.rb |
paperclip-compression-0.3.15 | lib/paperclip-compression/jpeg.rb |