最近从 RMagick 切换到 Mini_Magick。我收到错误undefined method 'write' for "":String
。这是我的上传器的样子......
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
问题在于fix_exif_rotation
方法。如果我注释掉这条线,process :fix_exif_rotation
一切都会很好。我已经删除了!从 auto_orient 调用的末尾开始,因为从 RMagick 切换到 Mini_Magick 时,这似乎给其他人带来了问题。
任何帮助将不胜感激。