Answer the question
In order to leave comments, you need to log in
[Rails] How to make image loading in WYSIWYG Redactor (imperavi.com)?
The question is in the title. Actually, when saving content, it translates pictures into base64 and tries to save them in the database.
Answer the question
In order to leave comments, you need to log in
Make a separate file uploader. Requirements for it:
- on the server - checking permissions, checking MIME, anti-XSS
- on the server, optionally - converting images, generating and saving thumbnails
- returns the parameters of the loaded in AJAX
Write a small script that will catch the response from the loader on the client, and insert pictures or links in the editor.
Example for CKEditor with jQuery:
if (response.is_image)
{
var thumb_name = response.file;
var full_name = thumb_name.replace('_thumb','');
$(response.editor).ckeditorGet().insertHtml(' <a href="' + full_name + '" target="_blank" class="dialog"><img src="' + thumb_name + '" border="0"></a> ');
}
else
{
$(response.editor).ckeditorGet().insertHtml(' <a href="' + response.file + '" target="_blank" rel="gallery">' + response.filename + '</a> <br /><br />');
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question