huacnlee / rucaptcha

Captcha Gem for Rails, which generates captcha image by Rust.

Home Page:https://huacnlee.github.io/rucaptcha

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

验证码显示报错

Dailin0811 opened this issue · comments

commented

Centos7下安装ImageMegick后,引用RuCaptcha,图片显示不出来,报如下错误,是什么原因
RuntimeError (RuCaptcha: convert: no encode delegate for this image format LABEL' @ error/constitute.c/WriteImage/1171.):
app/middleware/request_throttle.rb:59:in block in call' app/middleware/request_throttle.rb:257:in reserve_capacity'
app/middleware/request_throttle.rb:54:in call' app/middleware/request_context_session.rb:25:in call'
app/middleware/sessions_timeout.rb:22:in call' app/middleware/load_account.rb:12:in call'
app/middleware/request_context_generator.rb:49:in call' app/middleware/prevent_non_multipart_parse.rb:32:in call'`

ImageMagick 版本多少?

确定 ImageMagick 6.9+

commented

7.0.4的,convert -version的结果是
Version: ImageMagick 7.0.4-4 Q16 x86_64 2017-01-18 http://www.imagemagick.org Copyright: © 1999-2017 ImageMagick Studio LLC License: http://www.imagemagick.org/script/license.php Features: Cipher DPC HDRI OpenMP Delegates (built-in): bzlib freetype jpeg tiff x zlib

刚刚在 7.0.4-4 下面验证了一下,没有问题

Version: ImageMagick 7.0.4-4 Q16 x86_64 2017-01-15 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules 
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib

安装 ImageMagick 的时候需要安装 libpng

commented

问题解决了,在装ImageMagick时,少装了一些依赖包造成的。
@huacnlee 谢谢您上面提的建议,根据上面的思路,找到了问题所在!