Class: PaperclipCompression::Png
- Defined in:
- lib/paperclip-compression/png.rb
Constant Summary collapse
- KEY =
:png
- OPTIPNG_DEFAULT_OPTS =
'-o 5 -quiet'
Instance Method Summary collapse
-
#initialize(file, first_processor, options = {}) ⇒ Png
constructor
A new instance of Png.
- #make ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(file, first_processor, options = {}) ⇒ Png
Returns a new instance of Png.
7 8 9 10 |
# File 'lib/paperclip-compression/png.rb', line 7 def initialize(file, first_processor, = {}) super(file, first_processor) @config = PaperclipCompression::Config.create_with_fallbacks(, KEY, gem_defaults) end |
Instance Method Details
#make ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/paperclip-compression/png.rb', line 12 def make begin @config.process_file? ? process_file : unprocessed_tempfile rescue Cocaine::ExitStatusError => e raise Paperclip::Error, "OPTIPNG : There was an error processing #{@basename}" if @config.whiny rescue Cocaine::CommandNotFoundError => e raise Paperclip::Errors::CommandNotFoundError.new("Could not run 'optipng'. Please install optipng.") end end |