0
我使用carrierwave,minimagick和Rails 4文件上传PDF问题
我有一个FileUploader看起来像:
class 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格式的上传,我试图创建一个拇指第一页的png版本。如果上传图像,我调整和节能的一个拇指版本。
我得到的错误:NameError (uninitialized constant FileUploader::Magick)
现在,虽然它的作品时,我带走了块与unless