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 appreciate
Rails 4.2.0 solution:
How do you get http://github.com/galetahub/rails-ckeditor working so you can upload image files?
As is, CKEditor allows you to embed existing image URLs, but for CKEditor and Paperclip to work together so you can upload images, you will need ImageMagick. As I understand, it handles uploading the image data, making an image URL reference for the uploaded image data and the embedding of the uploaded image data's URL.
Add gem "ckeditor"
to your Gemfile
then run the $ bundle install
command.
Add this to /app/assets/javascripts/application.js
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require ckeditor/init <--------------- THIS
//= require_tree . <----------------------- ABOVE THIS
per: https://github.com/galetahub/ckeditor#how-to-generate-models-to-store-uploaded-files
Add this to:
/config/routes.rb
I put it before the resources
which utilize it
mount Ckeditor::Engine => '/ckeditor'
Using "form_for" and having set up an "Article" model with a title:string and text:text /app/views/articles/_form.html.erb
<%= f.label :text %>
<%= f.cktext_area :text, rows: 10 %> # <-------- "cktext_area"
Using "simple_form_for"
<%= f.input :body, :as => :ckeditor, input_html: {:ckeditor => {:toolbar => 'FULL'}}, class: "form-control" %>
per: https://richonrails.com/articles/getting-started-with-ckeditor
Add gem "paperclip"
to your Gemfile and $ bundle install
.
Then run the following two commands:
$ rails generate ckeditor:install --orm=active_record --backend=paperclip
and
$ rake db:migrate
For macOS Sierra:
$ brew install imagemagick
For other ImageMagick install options: https://www.imagemagick.org/script/install-source.php