首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spree::Admin::ImagesController#create中的曲别针::NotIdentifiedByImageMagickError

Spree::Admin::ImagesController#create中的曲别针::NotIdentifiedByImageMagickError
EN

Stack Overflow用户
提问于 2012-10-06 03:52:31
回答 3查看 3K关注 0票数 3

我正在尝试第一次设置Spree。一切都很顺利,直到我点击上传图片。我已经在Mac OSX Mountain Lion上使用自制软件安装了Imageamgick。上传任何图像都会出现以下错误。

代码语言:javascript
复制
Paperclip::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController#create

    Command :: identify -format %wx%h :file
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError: /var/folders/fq/9g_6hmg513g6137rb6sbghw00000gn/T/stream20121005-26943-16883d4.png is not recognized by the 'identify' command.>

Paperclip::NotIdentifiedByImageMagickError (/var/folders/fq/9g_6hmg513g6137rb6sbghw00000gn/T/stream20121005-26943-16883d4.png is not recognized by the 'identify' command.):
  paperclip (2.7.1) lib/paperclip/geometry.rb:29:in `from_file'
  spree_core (1.2.0) app/models/spree/image.rb:35:in `find_dimensions'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__1794851703999987262__post_process__1580526166879208018__callbacks'

当我从命令行运行identify时,我得到了以下输出

代码语言:javascript
复制
    Image Settings:
  -alpha option        on, activate, off, deactivate, set, opaque, copy
                       transparent, extract, background, or shape
  -antialias           remove pixel-aliasing
  -authenticate password
                       decipher image with this password
  -channel type        apply option to select image channels
  -colorspace type     alternate image colorspace
  -crop geometry       cut out a rectangular region of the image
  -define format:option
                       define one or more image format options
  -density geometry    horizontal and vertical density of the image
  -depth value         image depth
  -extract geometry    extract area from image
  -features distance   display image features (e.g. contrast, correlation)
  -format "string"     output formatted image characteristics
  -fuzz distance       colors within this distance are considered equal
  -gamma value         of gamma correction
  -interlace type      type of image interlacing scheme
  -interpolate method  pixel color interpolation method
  -limit type value    pixel cache resource limit
  -monitor             monitor progress
  -ping                efficiently determine image attributes
  -quiet               suppress all warning messages
  -regard-warnings     pay attention to warning messages
  -respect-parentheses settings remain in effect until parenthesis boundary
  -sampling-factor geometry
                       horizontal and vertical sampling factor
  -seed value          seed a new sequence of pseudo-random numbers
  -set attribute value set an image attribute
  -size geometry       width and height of image
  -strip               strip image of all profiles and comments
  -unique              display the number of unique colors in the image
  -units type          the units of image resolution
  -verbose             print detailed information about the image
  -virtual-pixel method
                       virtual pixel access method

Image Operators:
  -negate              replace every pixel with its complementary color 

Miscellaneous Options:
  -debug events        display copious debugging information
  -help                print program options
  -list type           print a list of supported option arguments
  -log format          format of debugging information
  -version             print version information

By default, the image format of `file' is determined by its magic
number.  To specify a particular image format, precede the filename
with an image format name and a colon (i.e. ps:image) or specify the
image type as the filename suffix (i.e. image.ps).  Specify 'file' as
'-' for standard input or output.

任何帮助都将不胜感激。

谢谢,科里

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2012-10-08 02:44:17

我的错误是Spree::Admin::ImagesController”中的-“Paperclip::NotIdentifiedByImageMagickError

几天前我修复了这个错误。

在此之前,我尝试过:

  • 更新
  • etc

(使用命令行工具)

  • 更新Imagemagick (我从源代码和二进制模块中尝试过)

  • 更新MacPort

  • 使用Brew (刷新Imagemagick的所有依赖项,使用“brew医生”),而不是MacPort

<代码>H111重新安装使用Imagemagick的所有gem<代码>H212<代码>H113包更新gem

当然,我在production.rb文件中有指向Imagemagick bin文件夹的“Paperclip::Attachment.default_options:command_path”选项。

我从头到尾做了几次,一次又一次。

但什么也帮不了我。

顺便说一下,在所有情况下,我都能很好地处理任何类型的测试图像的“转换”、“识别”和“显示”,但不是在我的rails应用程序(spree app)中。

我深入研究了dipper,并尝试在rails控制台中使用

代码语言:javascript
复制
Paperclip.run("identify", "-format %m :file", :file => "/path/to/image”) 

就像回形针一样。并且仅此命令的新格式(cocaine 0.4):

代码语言:javascript
复制
Paperclip.run("identify", "-format %m /path/to/image")

工作得很好!

结果,我发现cocaine 0.4是我的问题的根源。我试着在我的Gemfile中降级到0.3.2,我的Spree应用程序开始工作了!

我需要做的就是使用0.3.2而不是0.4!

票数 12
EN

Stack Overflow用户

发布于 2012-10-06 03:57:28

检查png格式是否在identify的编译格式列表中:

代码语言:javascript
复制
identify -list format

如果不是,您可能需要使用以下选项重新编译它:

代码语言:javascript
复制
./configure --prefix=/usr/local --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes
票数 0
EN

Stack Overflow用户

发布于 2013-08-29 13:37:05

我还遇到了图像文件不存在于公共文件夹中的问题。

我刚刚复制了一个具有相同名称的随机文件,然后一切都开始工作了。

代码语言:javascript
复制
parepclip 2.7.5 cocain 0.3.2
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12753157

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档