Question

Where I can find my images in rails app folders? I upload them by CKeditor and doesn't know where are they.

https://github.com/sferik/rails_admin
Was it helpful?

Solution

You'll need to create a model to handle the image uploads, typically with the likes of Paperclip or Carrierwave

From CKEditor's Github:

For files uploading support you need generage models for file storage. Currently supported next backends:

ActiveRecord (paperclip, carrierwave, dragonfly) Mongoid (paperclip, carrierwave, dragonfly)


Image Upload Model

You'll have a CKEditor model directory (with attachment_file.rb inside) - just add Paperclip options for it. Here's a question which will show you what to do: How exactly DO you integrate ckeditor with Paperclip so it can upload image files?

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top