This post describes how I tweaked RinEditor to enable copy+paste and drag+drop of images.
- Add the required plugins to ckeditor by unzipping them into jscripts/rin/editor/plugins. These are: button,toolbar,notification,notificationaggregator,lineutils,widget,uploadwidget,uploadimage. For example the button plugin can be found at http://ckeditor.com/addon/button
- Register the plugins with ckeditor in jscripts/rin/editor/config.js:
a.extraPlugins='button,toolbar,notification,notificationaggregator,lineutils,widget,uploadwidget,uploadimage'; - Register the script to handle uploads in config.js:
a.uploadURL='/path_to_your_mybb/ckeditor_upload/upload.php';a.imageUploadUrl='/path_to_your_mybb/ckeditor_upload/upload.php' - Download the mybb ckeditor plugin http://community.mybb.com/mods.php?action=view&pid=73
- Unzip somewhere and grab the ckeditor_upload directory. Put it into the path you registered in step 3
- In the ckeditor plugin, find the file inc/languages/english/ckeditor.lang.php and put it into the same path in your mybb installation
- Change the permission on the ckeditor_upload/uploads directory so that your http server can write files. On Ubuntu, this means
chown www-data:www-data ckeditor_upload/uploads - Edit ckeditor_upload/upload.php to match the standard ckeditor syntax for uploading files
- Change
$_FILES['upl'] - to
$_FILES['upload'] - (six edits)
- Change
echo json_encode(array("status" => "error", "message" => $lang->ckeditor_upload_invalid_type)); - to
echo json_encode(array("uploaded" => 0, "error" => array("message" => $lang->ckeditor_upload_invalid_type))); - (3 edits)
- Change the success message to
echo json_encode(array("uploaded" => 1, "fileName" => $_FILES['upload']['name'], "url" => $mybb->settings['bburl'].'/ckeditor_upload/uploads/'.$_FILES['upload']['name'])); - (1 edit)
- Change
- I don't think all the files under ckeditor_upload are actually required
- Is there a better place for the upload script and upload directory?