lib/carrierwave/processing/mini_magick.rb
##
# Manipulate the image with MiniMagick. This method will load up an image
# and then pass each of its frames to the supplied block. It will then
# save the image to disk.
#
# NOTE: This method exists mostly for backwards compatibility, you should
# probably use #minimagick!.
#
# === Gotcha
#
# This method assumes that the object responds to +current_path+.
# Any class that this module is mixed into must have a +current_path+ method.
# CarrierWave::Uploader does, so you won't need to worry about this in
# most cases.
#
# === Yields
#
# [MiniMagick::Image] manipulations to perform
#
# === Raises
#
# [CarrierWave::ProcessingError] if manipulation failed.
#
Manipulate the image with MiniMagick. This method will load up an image
and then pass each of its frames to the supplied block. It will then
save the image to disk.

This method exists mostly for backwards compatibility, you should
probably use #minimagick!.

Gotcha

This method assumes that the object responds to +current_path+.
Any class that this module is mixed into must have a +current_path+ method.
CarrierWave::Uploader does, so you won't need to worry about this in
most cases.

Yields

[MiniMagick::Image] manipulations to perform

Raises


Manipulate the image with MiniMagick . This method will load up an image and then pass each of its frames to the supplied block . It will then save the image to disk . This method exists mostly for backwards compatibility you should probably use #minimagick! . Gotcha This method assumes that the object responds to + current_path + . Any class that this module is mixed into must have a + current_path + method . CarrierWave :: Uploader does so you won ' t need to worry about this in most cases . Yields [ MiniMagick :: Image ] manipulations to perform Raises
def manipulate!
      cache_stored_file! if !cached?
      image = ::MiniMagick::Image.open(current_path)
      image = yield(image)
      FileUtils.mv image.path, current_path
      image.run_command("identify", current_path)
    rescue ::MiniMagick::Error, ::MiniMagick::Invalid
      message = I18n.translate(:"errors.messages.processing_error")
      raise CarrierWave::ProcessingError, message
    ensure
      image.destroy! if image
    end
def manipulate! cache_stored_file! if ! cached? image = :: MiniMagick :: Image . open ( current_path ) image = yield ( image ) FileUtils . mv image . path , current_path image . run_command ( "identify" , current_path ) rescue :: MiniMagick :: Error , :: MiniMagick :: Invalid message = I18n . translate ( :" errors.messages.processing_error " ) raise CarrierWave :: ProcessingError , message ensure image . destroy! if image end
Manipulate the image with MiniMagick.
Manipulate the image with MiniMagick .