载波+ mini_magick宝石=没有图像错误 [英] carrierwave + mini_magick gems = not an image error
问题描述
我正在使用:
- carrierwave 0.6.0
- rails 3.2.1
- mini_magick 3.4
- ruby 1.9.2p290
在图像上传期间,我要调整上传大小图片:
And during image uploading I want to resize uploading pic:
(image_uploader.rb)
process :resize_to_fit => [200, 200]
但是在上传图片后出现错误:
But after image uploading I've got an error:
1 error prohibited this organization from being saved:
Image image Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: MiniMagick::Invalid
PS。如果我不调整大小,则可以上传图片。
PS. If I'm not resizing, image upload works fine.
PS2。我尝试添加config / environment.rb:
PS2. I tried to add in config/environment.rb:
require 'rubygems'
require "mini_magick"
但没有成功(仍然无法正常工作-顺便说一句,当使用mini_magick作为宝石时是否需要?)
but without success (still not working - btw. is it required when using mini_magick as a gem?)
推荐答案
我确定您已经解决了这个问题(至少希望如此!将近两个月!),但这是一个刚刚对我有用的解决方案:
I'm sure that you've solved this by now (at least hopefully! It's almost two months later!), but here's a solution that worked for me just now:
通过自制软件卸载imagemagick:
Uninstall imagemagick through homebrew:
-
酿造卸载imagemagick
brew uninstall imagemagick
清理您的自制目录:
-
brew cleanup --force -s
- -force删除所有过时的仅桶装啤酒,-s删除所有缓存的下载文件
重新安装imagemagick:
Reinstall imagemagick:
-
brew安装imagemagick
brew install imagemagick
毕竟,你应该很好去!
这篇关于载波+ mini_magick宝石=没有图像错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!