简体   繁体   English

回形针3,不能使用样式

[英]Paperclip in rails 3, cannot use styles

I have followed the following tuto http://www.jameswilding.net/blog/2010/07/paperclip-rails-3/ to have paperclip working on my rails app. 我遵循了以下教程http://www.jameswilding.net/blog/2010/07/paperclip-rails-3/,以使回形针在我的rails应用程序上正常工作。 The think is... the item creation does not work when I specified the "styles" in my model: 我的想法是...当我在模型中指定“样式”时,项目创建不起作用:

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

On the form, I pick up a photo and then when I hit the 'create item' button, I have the following error (error that is not there anymore if I do not specify any styles in the model). 在表单上,​​我拾取了一张照片,然后单击“创建项目”按钮时,出现以下错误(如果我未在模型中指定任何样式,该错误将不再存在)。

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>

Any idea ? 任何想法 ?

Thanks a lot, 非常感谢,

Luc 卢克

Cant really make out whats going wrong.. But have u installed ImageMagick? 无法真正找出问题所在。.但是您是否安装了ImageMagick? It doesnt mention it in the blog but u need it to resize the pictures. 它没有在博客中提到它,但是您需要它来调整图片的大小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM