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