Class: PaperclipCompression::Jpeg

Inherits:
Base
  • Object
show all
Defined in:
lib/paperclip-compression/jpeg.rb

Constant Summary collapse

JPEGTRAN_DEFAULT_OPTS =
'-copy none -optimize -perfect'

Instance Method Summary collapse

Methods inherited from Base

make

Constructor Details

#initialize(file, first_processor, options = {}) ⇒ Jpeg

Returns a new instance of Jpeg.



6
7
8
9
# File 'lib/paperclip-compression/jpeg.rb', line 6

def initialize(file, first_processor, options = {})
  super(file, first_processor, options)
  @cli_opts = init_cli_opts(:jpeg, default_opts)
end

Instance Method Details

#makeObject



11
12
13
14
15
16
17
18
19
# File 'lib/paperclip-compression/jpeg.rb', line 11

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