Question

Recently switched from RMagick to Mini_Magick. I am receiving the error undefined method 'write' for "":String. Here's what my uploader looks like...

class BackgroundUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick
  include CarrierWave::MimeTypes
  process :set_content_type

  storage :file

  def store_dir
    "uploads/backgrounds/#{model.id}"
  end

  def default_url
    "/assets/fallback/default.jpg"
  end

  process :resize_to_fit => [1024, 1024]
  process :convert => 'jpg'
  process :fix_exif_rotation

  def fix_exif_rotation
    manipulate! do |img|
      img.auto_orient
      img = img.gaussian_blur 5
      img = yield(img) if block_given?
      img
    end
  end

  def extension_white_list
    %w(jpg jpeg png)
  end

end

The issue lies in the fix_exif_rotation method. If I comment out the line process :fix_exif_rotation everything works just fine. I've removed the ! from the end of the auto_orient call as that seems to have caused issues for others when switching from RMagick to Mini_Magick.

Any help would be greatly appreciated.

Était-ce utile?

La solution

This comment from the above linked "Related issue 2" suggests assigning to img, except(!?) in the yield, could break things, so my first guess is to try just img.gaussian_blur 5 instead of img = img.gaussian_blur 5.

Otherwise: Stack trace?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top