3

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

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'

当我从命令行运行识别时,我得到以下输出

    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.

任何帮助将不胜感激。

谢谢,科里

4

3 回答 3

12

我的错误是 - “<strong>Paperclip::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController”</p>

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

在此之前我尝试过:

  • 更新 XCode(使用命令行工具)
  • 更新 Imagemagick(我从源代码和二进制模块尝试过)
  • 更新 MacPort
  • 使用 Brew(使用 Imagemagic 的所有依赖项刷新,使用“brew doctor”),而不是 MacPort
  • 重新安装所有使用 Imagemagick 的 gem
  • 捆绑更新
  • ETC

并且确定我在 production.rb 文件中有我的“Paperclip::Attachment.default_options[:command_path]”选项指向 Imagemagick bin 文件夹。

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

但没有什么能帮助我。

顺便说一句,在所有情况下,我都可以很好地使用任何类型的测试图像进​​行“转换”、“识别”和“显示”,但在我的 Rails 应用程序(spree 应用程序)中却没有。

我潜入北斗并尝试在 Rails 控制台内进行研究

Paperclip.run("identify", "-format %m :file", :file => "/path/to/image”) 

就像回形针一样。并且只有此命令的新格式(可卡因 0.4):

Paperclip.run("identify", "-format %m /path/to/image")

工作正常!!!

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

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

于 2012-10-07T18:44:16.853 回答
0

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

identify -list format

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

./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
于 2012-10-05T19:57:28.450 回答
0

当公共文件夹中不存在图像文件时,我也遇到了问题。
我刚刚复制了一个同名的随机文件,一切都开始工作了。

parepclip 2.7.5 cocain 0.3.2
于 2013-08-29T05:37:04.620 回答