简体   繁体   中英

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. 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? It doesnt mention it in the blog but u need it to resize the pictures.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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