簡體   English   中英

回形針3,不能使用樣式

[英]Paperclip in rails 3, cannot use styles

我遵循了以下教程http://www.jameswilding.net/blog/2010/07/paperclip-rails-3/,以使回形針在我的rails應用程序上正常工作。 我的想法是...當我在模型中指定“樣式”時,項目創建不起作用:

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>

任何想法 ?

非常感謝,

盧克

無法真正找出問題所在。.但是您是否安裝了ImageMagick? 它沒有在博客中提到它,但是您需要它來調整圖片的大小。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM