2009-10-26 8 views
5

जब मैं Ruby on Rails में अपनी स्थानीय मशीन पर Paperclip का उपयोग करके एक फोटो अपलोड करने का प्रयास करता हूं तो यह पूरी तरह से काम करता है।पेपरक्लिप/पैसेंजर NotIdentifiedByImageMagickError:

जब मैं हमारे लिनक्स पर पेपरक्लिप का उपयोग कर रेल (CentOS 5.2) अपाचे और Phusion Passenger साथ सर्वर पर रूबी में एक तस्वीर अपलोड करने की कोशिश, मैं मिलता है:

2 errors prohibited this user from being saved 
There were problems with the following fields: 
- Avatar /tmp/stream20091026-21120-1qdbnul-0 is not recognized by the 'identify' command. 
- Avatar /tmp/stream20091026-21120-1qdbnul-0 is not recognized by the 'identify' command. 

मैं जोड़ने की कोशिश की:

Paperclip.options[:command_path] = "/usr/local/bin" 

उत्पादन.आरबी पर लेकिन इससे कोई फर्क नहीं पड़ता।

मैं निम्नलिखित त्रुटियाँ प्राप्त लॉग फाइल में:

Parameters: {"commit"=>"Upload", "action"=>"update", "_method"=>"put", "authenticity_token"=>"419410afc22737cd2f6b6096a95327db76a48ba9", "controller"=>"users", "user"=>{"avatar"=>#}} [paperclip] Saving attachments. [paperclip] An error was received while processing:

/tmp/stream20091026-20752-1g568yk-0 is not recognized by the 'identify' command.

उत्तर

4

पहचानें ImageMagick पैकेज के अंदर एक कमांड लाइन उपयोगिता है।

अपने मुखपृष्ठ से:

The identify program describes the format and characteristics of one or more image files. It also reports if an image is incomplete or corrupt. The information returned includes the image number, the file name, the width and height of the image, whether the image is colormapped or not, the number of colors in the image, the number of bytes in the image, the format of the image (JPEG, PNM, etc.), and finally the number of seconds it took to read and process the image. Many more attributes are available with the verbose option.

पहले, सर्वर पर चित्र को कॉपी और उस पर आदेश की पहचान चलाते हैं। आपको कुछ प्राप्त करना चाहिए:

identify ~/capture.jpg 
capture.jpg JPEG 1216x244 1216x244+0+0 8-bit DirectClass 97.7kb 

यदि आपको कोई त्रुटि मिलती है, तो अपने सर्वर पर ImageMagick पैकेज को अपग्रेड करने का प्रयास करें। आप एक अद्यतन द्विआधारी रिलीज यहां मिल सकता है: के बारे में मैं बाहर काम करने में कामयाब रहे खिलवाड़ का एक बहुत बाद http://www.imagemagick.org/script/binary-releases.php

+0

कि .jpeg के लिए पुस्तकालयों .png हमारे लिनक्स उत्पादन सर्वर पर स्थापित नहीं थे, लेकिन वे मेरे आईमैक पर स्थापित हैं। तो मुझे उन पुस्तकालयों को डाउनलोड करना था और उन्हें स्थापित करना था और फिर छविमैगिक को पुनर्स्थापित करना था (तथ्य से मदद नहीं की गई imagemagick.org सभी दोपहर नीचे आ गई है :() – Chris

0
एक ही त्रुटि के साथ मेरे मामले में

, फिर से स्थापित करने imagemagic बाहर में मदद की (ubuntu 12.10)