imagemagick - RefineryCMS 图片上传错误,ImageMagick CentOS 5.5

标签 imagemagick centos image-uploading refinerycms

我在我的服务器(CentOs 5.5)上安装了RefineryCMS,除了上传图像之外,一切正常。它将显示如下错误:

NoMethodError in Refinery::Admin::ImagesController#create

   undefined method `downcase' for nil:NilClass

我通过键入以下内容安装了 ImageMagick:

sudo yum install ImageMagick

网上查了一下,yum安装的ImageMagick好像太旧了(版本6.2.x) 然后我将其删除,从源代码成功安装了ImageMagick v6.7.7。 现在,当我尝试上传图像时,精炼厂显示:

Dragonfly::Shell::CommandFailed in Refinery::Admin::ImagesController#create

   Command failed (identify '/tmp/RackMultipart20120628-29239-70xr45') with exit status 127

但是,如果我在命令行中运行该命令“identify '/tmp/RackMultipart20120628-29239-70xr45'”,它将显示结果,没有任何错误。 Dragonfly 似乎无法识别我安装的最新版本的 ImageMagick。谁能告诉我如何配置它?或者我应该升级我的centOS?(我不希望)

最佳答案

嗯,我已经为这个问题苦苦挣扎了一个多星期了。 我也在Github上问了这个问题,最后得到了解决方案。 请参阅:https://github.com/resolve/refinerycms/issues/1781#issuecomment-6823858

这个问题是因为Dragonfly找不到imagemagick造成的。 您可以尝试将以下代码添加到config/application.rb

initializer 'override-image-magick-paths', :after => 'attach-refinery-images-with-      dragonfly' do
  app=Dragonfly[:refinery_images]
  app.configure_with(:imagemagick)
  app.configure do |c|
    c.convert_command = "/usr/local/bin/convert"          # defaults to "convert"
    c.identify_command = "/usr/local/bin/identify"        # defaults to "identify"
  end
end

根据您的imagemagick安装修改路径。 您可以使用which命令来查找路径。例如哪个转换

但是,这对我来说仍然不起作用。 最后,toymachiner62找到一个简单且完美的解决方案。

即使用符号链接(symbolic link):

$ cd /usr/bin
$ ln -s /usr/local/bin/convert convert             
$ ln -s /usr/local/bin/identify identify

同时修改/usr/local/bin/convert 的安装路径。 这看起来像我的/usr/local/bin 路径不在我的 $PATH 中,但实际上它是。 蜻蜓似乎无论如何都找不到它。

关于imagemagick - RefineryCMS 图片上传错误,ImageMagick CentOS 5.5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11248099/

相关文章:

c# - Imagemagick:优化截断图像的识别速度

php - 许多应用服务器共享 memcached 服务器

javascript - Vue Js - 文件输入更改后发送 axios 请求

php - 如何使用 mysqli 准备从数据库检索图像?

colors - 在ImageMagick中将TIFF图像转换为PNG时颜色错误

c++ - ImageMagick 与 Cairo 在 vector 图形光栅化方面的对比

ruby - 如何修改图像的颜色以消除活力?

centos - Centos 7上两个版本的libcurl导致CRYPTO_num_locks错误

centos - 我无法通过 "net ads join"(winbind) 连接到 AD

php - 如何使用php将图片存储到mysql数据库中