Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How exactly DO you integrate ckeditor with Paperclip so it can upload image files?

How do you get http://github.com/galetahub/rails-ckeditor working so you can upload image files? I don't think I'll use the s3 storage...

any help would be appreciated.

like image 242
dmonopoly Avatar asked Sep 05 '10 21:09

dmonopoly


1 Answers

Yes you can. I assume that you have paperclip already set up for S3. So you have only edit the picture.rb and attachement_file.rb in you model directory (app/model/ckeditor/) and replace these lines

  has_attached_file :data,
                    :url => "/ckeditor_assets/attachments/:id/:filename",
                    :path => ":rails_root/public/ckeditor_assets/attachments/:id/:filename"

with your papeclip version has_attached_file:

  has_attached_file :data, :styles => { :content => '575>', :thumb => '80x80#' },
    :storage => :s3, :s3_credentials => "#{Rails.root}/config/s3.yml", :path => ":attachment/:id/:style.:extension",
    :url => ":s3_domain_url"

That's it. Btw: this is example from Rails 3.

like image 105
zaparka Avatar answered Sep 27 '22 19:09

zaparka