【发布时间】:2016-10-27 12:26:38
【问题描述】:
我正在使用carrierwave 和mini_magick gems 来使用rails_admin 中的图像。当我上传图片失败并出现以下错误:
Failed to manipulate with MiniMagick, maybe it is not an image?
Original Error: `identify C:/Users/Zeke/AppData/Local/Temp/mini_magick20161027-21132-xdongz.png` failed with error:
identify.exe: RegistryKeyLookupFailed `CoderModulesPath' @ error/module.c/GetMagickModulePath/662.
identify.exe: no decode delegate for this image format `PNG' @ error/constitute.c/ReadImage/501.
当我在uploader.rb 中不包含以下行时,不会发生这种情况
# Process files as they are uploaded:
process resize_to_fit: [800, 600]
# Create different versions of your uploaded files:
version :thumb do
process resize_to_fill: [40, 30]
end
我需要缩略图,我该怎么做?
这是我确定的:
- ImageMagick 已安装并且确实正在工作。我我能够将 png 转换为 jpg 和 jpg 转换为 png,识别图像...
-
identify C:/Users/Zeke/AppData/Local/Temp/mini_magick20161027-21132-xdongz.png在cmd中运行时成功执行(如果重要,没有管理员权限)
-
identify -list format给出了一个 huuuuge 列表,其中几乎包含了我能想到的所有图像格式。是的,它包括JPG、JPEG、PNG以及我需要的所有内容。
-
convert -version包括 jpeg png 代表
我做错了什么?
【问题讨论】:
-
目前在 Win 10 上使用 ruby
2.2.4-p230和 rails5.0.0.1 -
密切相关的imagemagick.org/discourse-server/viewtopic.php?t=26856,建议的解决方案不起作用;如here 所述,尝试将三个变量添加到路径中,但没有用
-
我不知道 ruby 或 rails,但我怀疑您不止一次安装了 ImageMagick,并且在命令提示符下使用了不同的 ImageMagick(可以执行 PNG),而您可能正在使用不同的Rails 中的 ImageMagick 无法执行 PNG。尝试在 rails 中设置 PATH 以显式使用与在命令提示符下使用相同的 ImageMagick。或者尝试在整个系统中搜索另一个
convert或identify。 -
或者尝试暂时将在命令提示符下工作的
convert.exe重命名为convert.orig,然后运行Rails 并查看它是否注意到这一点,或者它是否完全使用了不同的可执行文件。 -
我很遗憾,正好安装了一个 imageMagick,我现在才安装它
标签: ruby-on-rails imagemagick carrierwave rails-admin minimagick