rails 3 paperclip imagemagick problem

僤鯓⒐⒋嵵緔 提交于 2020-01-14 06:19:46

问题


I have been trying to get paperclip working for a few days now with no luck! From what I am aware this error below is related to imagemagick. I have tried to uninstall and install imagemagick both with macports and manually. Also, have Paperclip.options[:command_path] = "/usr/local/bin" set. It's starting to drive me nuts!

Photo /var/folders/A7/A7X8PAnOFsCTHkFpeODoO++++TI/-Tmp-/stream,65411,0.jpeg is not recognized by the 'identify' command.

I'm running snow leopard.

This appears when I run the rails server.. "/Users/michaelorcutt/shudder/vendor/plugins/paperclip/lib/paperclip.rb:50: warning: already initialized constant VERSION"


回答1:


I've seen this problem when I was configuring ImageMagick for Rails 3 on OSX. After installing ImageMagick from mac ports and then the binary things still didn't work correctly. What finally did the trick ? finding the location of the identify binary.

which identify

put that path into your :

Paperclip.options[:command_path] =

And it should finally work.




回答2:


Here is the list of things that needs to be checked for error "NotIdentifiedByImageMagickError":

  1. Ensure that Imagemagick is installed on your system and its in the ENV path try the command $ which identify Or $which convert. For Ubuntu its usally in /usr/local/bin or /usr/bin.
  2. Note the path of the above command and update the config/environments/development.rb (if you are working in dev mode) with the following line.
Paperclip.options[:command_path]= '/usr/bin'

Incase, if you are still facing the issue check the installation of ImageMagick. If you installed from the source, the may be try packaged installation ( sudo apt-get install imagemagick)

~arunky




回答3:


I currently use Paperclip, ImageMagick from macports in my Snow Leopard and havent seen that issue, are you sure that file is jpg? Try renaming it to jpg (it would be stupid, but you have to rule out everything).

Try opening several of your JPG files in a text editor, and open that one and see if the first 4 characters match (or better yet do it in a binary editor). Maybe it is a file your operating system or other software recognizes as image, but is not an actual jpg and ImageMagick is confused.



来源:https://stackoverflow.com/questions/2994701/rails-3-paperclip-imagemagick-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!