2011-03-24 100 views
0

我已經按照以下tuto http://www.jameswilding.net/blog/2010/07/paperclip-rails-3/在我的rails應用程序上使用回形針。 的認爲這是...當我指定我的模型中的「風格」的項目創造不起作用:回形針3中的回形針,不能使用樣式

class Picture < ActiveRecord::Base 
    has_attached_file :pict, :styles => { :small => "150x150>" } 
    validates_attachment_presence :pict 
    validates_attachment_size :pict, :less_than => 5.megabytes 
    validates_attachment_content_type :pict, :content_type => ['image/jpeg', 'image/png', 'image/gif'] 
end 

在窗體上,我拿起一張照片,然後當我打的「創建項目」按鈕,我有以下錯誤(如果我沒有在模型中指定任何樣式,則不存在該錯誤)。

Started POST "/pictures" for 127.0.0.1 at Thu Mar 24 14:39:15 +0100 2011 
Processing by PicturesController#create as HTML 
Parameters: {"commit"=>"Create Picture",  "authenticity_token"=>"ZRTdrxt0d84D2WZvOXcOaRStcjmXazZBLRjtCmTsNKU=", "utf8"=>"✓", "picture"=>{"pict"=>#<ActionDispatch::Http::UploadedFile:0x1041869d8 @original_filename="IMG_0016.JPG", @headers="Content-Disposition: form-data; name=\"picture[pict]\"; filename=\"IMG_0016.JPG\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/var/folders/Hi/HiUKqJ7THYS7P-0e1NyczE+++TI/-Tmp-/RackMultipart20110324-1930-d28tly-0>, @content_type="image/jpeg">}} 
[paperclip] identify -format %wx%h '/var/folders/Hi/HiUKqJ7THYS7P-0e1NyczE+++TI/-Tmp-/stream20110324-1930-1bxai3m-0.JPG[0]' 2>/dev/null 
[paperclip] An error was received while processing: #<Paperclip::CommandNotFoundError: Paperclip::CommandNotFoundError> 

任何想法?

非常感謝,

呂克

回答

1

不能真正做出來怎麼回事錯。但具有u安裝ImageMagick的?它沒有在博客中提到它,但你需要它來調整圖片大小。

+0

嗯......我其實沒有安裝imagemagick。你是對的,這可能是一塊失蹤。在我有的錯誤信息中,我們看到回形針遇到命令未找到錯誤,但沒有詳細說明... – Luc 2011-03-24 14:13:27

+0

sudo port install ImageMagick修復了這個問題。非常感謝 – Luc 2011-03-24 21:24:44