Module: AttachmerbFu::Processors::MiniMagickProcessor::ClassMethods
- Defined in:
- lib/attachmerb_fu/processors/mini_magick_processor.rb
Instance Method Summary collapse
-
#with_image(file, &block) ⇒ Object
Yields a block containing an MiniMagick Image for the given binary data.
Instance Method Details
#with_image(file, &block) ⇒ Object
Yields a block containing an MiniMagick Image for the given binary data.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/attachmerb_fu/processors/mini_magick_processor.rb', line 12 def with_image(file, &block) begin binary_data = file.is_a?(MiniMagick::Image) ? file : MiniMagick::Image.from_file(file) unless !Object.const_defined?(:MiniMagick) rescue # Log the failure to load the image. logger.debug("Exception working with image: #{$!}") binary_data = nil end block.call binary_data if block && binary_data ensure !binary_data.nil? end |