Example of how to change imgur dragdrop support to your own server or host
Attention and Caution: This is just an example of how to get started. If you implement this you will be responsible for improvements such as fixing errors or bugs. No support will be offered and much less this is to be maintained or updated.
This example uses a plugin that was made in a hurry with hardcoded language string. As stated above, I will not accept any related complaints, this is just a demonstration of where to start and base the implementation.
Steps:
1 - Done all steps of Tips:
How unofficially enable imgur drag and drop support
2 - Create folder called "rin_uploads" to your root folder. After created folder you must set same chmod and chown of "uploads" folder.
3 - Open and edit root/jscripts/rin/editor/config.js
Find:
config.imageUploadUrl = 'https://api.imgur.com/3/image';
Replace:
config.imageUploadUrl = 'xmlhttp.php?action=rin_img_up&my_post_key='+my_post_key;
3 - Open and edit root/jscripts/rin/editor/plugins/imgur_drag/plugin.js
replace all content with code below:
( function() {
CKEDITOR.plugins.add( 'imgur_drag',{
requires: 'uploadimage',
isSupportedEnvironment: function() {
return CKEDITOR.plugins.clipboard.isFileApiSupported;
},
init: function( editor ) {
if ( !this.isSupportedEnvironment() ) {
return;
}
var imgur_drag_and_drop_support = editor.config.imageUploadUrl !== undefined ? editor.config.imageUploadUrl : false;
if (!(imgur_drag_and_drop_support)) {
return;
}
editor.on( 'fileUploadRequest', function( evt ) {
var notification = new CKEDITOR.plugins.notification( evt.editor, { message: RinEditor['Uploading'], type: 'success' } );
notification.show();
var fileLoader = evt.data.fileLoader,
formData = new FormData(),
xhr = fileLoader.xhr;
xhr.open( 'POST', fileLoader.uploadUrl, true );
formData.append('rin_img_upload', fileLoader.file);
fileLoader.xhr.send( formData );
evt.stop();
}, null, null, 4 );
editor.on( 'fileUploadResponse', function( evt ) {
var fileLoader = evt.data.fileLoader,
xhr = fileLoader.xhr,
data = evt.data;
try {
var response = JSON.parse( xhr.responseText );
if ( response.data.error ) {
data.message = response.data.error;
}
if ( !response.success ) {
evt.cancel();
} else {
data.fileName = response.data.fileName;
data.url = response.data.url;
data.width = response.data.width;
data.height = response.data.height;
evt.stop();
}
} catch ( err ) {
data.message = fileLoader.lang.filetools.responseError;
evt.cancel();
}
} );
}
});
})();
5 - Clear your browser's cache, if you're using cloudflare, you also need to clear your cloudflare cache (
https://support.cloudflare.com/hc/en-us/...Cloudflare).
6 - Install plugin of attachment.
7 - Configure settings of plugin
It´s all.