【发布时间】:2017-01-27 04:57:27
【问题描述】:
一直在尝试使用 Carrierwave::MiniMagick 上传照片,安装了两个 gem,但尝试上传时出现此错误:
使用 MiniMagick 操作图片失败,可能不是图片?原始错误:
identify C:/Users/JOHNO~1/AppData/Local/Temp/mini_magick20160918-2884-cgqjcw.png失败并出现错误:识别:UnableToOpenConfigureFilemagic.xml' @ warning/configure.c/GetConfigureOptions/709. identify: UnableToOpenConfigureFiledelegates.xml'@warning/configure.c/GetConfigureOptions/709。识别:UnableToOpenModuleFile 'C:\ImageMagick-7.0.2-Q16\modules\coders\IM_MOD_RL_PNG_.dll':没有这样的文件或目录@warning/module.c/GetMagickModulePath/680。识别:NoDecodeDelegateForThisImageFormat `PNG'@error/constitute.c/ReadImage/508。
页面重新加载时,结果页面显示,但图像不显示。
这是我的上传者:
class PictureUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
version :thumb do
process :resize_to_limit => [200, 200]
end
def extension_white_list
%w(jpg jpeg gif png)
end
end
这是我的模型:
class Article < ActiveRecord::Base
mount_uploader :picture, PictureUploader
end
这是我的迁移文件:
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.string :title
t.text :body
t.string :picture
t.timestamps null: false
end
end
end
请各位大侠帮忙???....谢谢
【问题讨论】:
标签: ruby-on-rails-4 carrierwave minimagick