我正在使用载波和rmagick来处理图像上传。但是在上传.svg格式文件时遇到了一个问题。
Failed to manipulate with rmagick, maybe it is not an image?
这就是我的上传器外观
class ClientImageUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
process :resize_to_fit => [200, 200]
version :thumb do
process resize_to_fit: [320, 320]
end
def extension_whitelist
%w(jpg jpeg gif png svg)
end
end
我调查了一下并进行了更改,但仍然显示相同的错误。 carrierwave png thumbnails from svg upload
我所做的更改是
version :thumb do
def full_filename(for_file)
super(for_file).chomp(File.extname(super(for_file))) + '.png'
end
process resize_to_fit: [320, 320]
end
知道我要去哪里了吗