加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby-on-rails – Spree中的Paperclip :: NotIdentifiedByImageM

发布时间:2020-12-17 01:46:42 所属栏目:百科 来源:网络整理
导读:我试图第一次设置Spree.一切顺利,直到我上传图片.我在Mac OSX Mountain Lion上使用自制软件安装了 Imageamgick.上传任何图像会给我以下错误. Paperclip::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController#create Command :: identify -fo
我试图第一次设置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.

任何帮助将不胜感激.

谢谢,
科里

解决方法

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

我几天前修正了这个错误.

在此之前我试过:

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

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

好几次,我一次又一次地从a到z做过.

但没有什么可以帮助我.

顺便说一句,在所有情况下,我都使用任何类型的测试图像进??行了很好的“转换”,“识别”和“显示”,但不是在我的rails应用程序(狂欢应用程序)中.

我潜入了北斗,并尝试在rails console内进行研究

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!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读