Spree :: Admin :: ImagesController #create中的Paperclip :: NotIdentifiedByImageMagickError [英] Paperclip::NotIdentifiedByImageMagickError in Spree::Admin::ImagesController#create
问题描述
我第一次尝试设置Spree。一切顺利,直到我上传图片。我在Mac OSX Mountain Lion上使用自制程序安装了Imageamgick。上传任何图像都会出现以下错误。
I am attempting to setup Spree for the first time. Everything was going well until I hit the image upload. I have installed Imageamgick using homebrew on Mac OSX Mountain Lion. Uploading any image gives me the following error.
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'
当我运行识别时从命令行我得到以下输出
When I run identify from the command line I get the following output
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.
我们非常感谢任何帮助。
Any help would be greatly appreciated.
谢谢,
Cory
Thanks, Cory
推荐答案
我的错误是 - Spree :: Admin中的Paperclip :: NotIdentifiedByImageMagickError :: ImagesController
我几天前修正了这个错误。
I fixed this error some days ago.
在此之前我试过:
- 更新XCode(使用命令行工具) )
- 更新Imagemagick(我从源代码尝试并作为二进制模块)
- 更新MacPort
- 使用Brew(使用Imagemagic的所有依赖项刷新,
使用brew doctor),而不是MacPort - 重新安装所有使用Imagemagick的宝石
- 捆绑更新
- 等
- Update XCode (with Command-Line Tools)
- Update Imagemagick (i tried it from source and as binary module)
- Update MacPort
- Used Brew (refreshing with all dependencies for Imagemagic, used "brew doctor"), not MacPort
- Reinstall all gems that use Imagemagick
- Bundle update
- etc
确定我有Paperclip :: Attachment.default_options [ :command_path]指向Imagemagick bin文件夹的production.rb文件中的选项。
And sure I had my "Paperclip::Attachment.default_options[:command_path]" option in production.rb file pointing to Imagemagick bin folder.
我多次从a到z,一遍又一遍地做。
Several times i did it from a to z, again and again.
但没有什么可以帮助我。
But nothing could help me.
顺便说一下,在所有情况下我都做得很好转换,识别和显示带有任何类型的测试图像,但不能在我的rails应用程序(狂欢应用程序)中显示。
By the way, in all cases i had worked fine "convert", "identify" and "display" with test images of any kind, but not in my rails app (spree app).
我潜水并试图做使用
Paperclip.run("identify", "-format %m :file", :file => "/path/to/image")
如回形针那样。只有新格式(可卡因0.4)此命令:
as paperclip do. And only new format (cocaine 0.4) of this command:
Paperclip.run("identify", "-format %m /path/to/image")
工作正常!!!
作为一个结果,我发现可卡因0.4是我问题的根源。我尝试在我的Gemfile中降级为可卡因0.3.2并且我的Spree应用程序开始工作!!!
As a result, i found that cocaine 0.4 is the source of my problem. I tried downgrade to cocaine 0.3.2 in my Gemfile and my Spree app start working!!!
所有我需要做的是使用可卡因0.3.2而不是0.4 !!!
All i need to do is use cocaine 0.3.2 instead of 0.4!!!
这篇关于Spree :: Admin :: ImagesController #create中的Paperclip :: NotIdentifiedByImageMagickError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!