我正在使用carrierwave,minimagick和Rails 4。
我有一个类似于:
的FileUploaderclass FileUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
version :thumb, if: :image? do
process :resize_to_limit => [50, 50]
end
version :thumb, unless: :image? do
process :cover
process :resize_to_fill => [50, 50, Magick::NorthGravity]
process :convert => 'png'
end
protected
def image?(new_file)
new_file.content_type.start_with? 'image'
end
def cover
manipulate! do |frame, index|
frame if index.zero?
end
end
end
如果上传了pdf,我正在尝试创建第一页的thumb png版本。如果上传了图片,我正在调整大小并保存它的拇指版本。
我现在收到错误:NameError (uninitialized constant FileUploader::Magick)
,但是当我带走unless