I'm trying to write a plugin to upload images to imgur. This is how the dialog window looks like.
And here's the code I've written so far.
CKEDITOR.plugins.add( 'imgurUpload', { init : function ( editor ) { editor.addCommand( 'imgurUploadDialog', new CKEDITOR.dialogCommand( 'imgurUploadDialog' ) ); //creating the button displayed in the toolbar editor.ui.addButton( 'ImgurUpload', { label : 'Upload an image to imgur', command : 'imgurUploadDialog', icon : this.path + 'images/icon.png' }); //creating the dialog window CKEDITOR.dialog.add( 'imgurUploadDialog', function( editor ) { return { title : 'Upload an Image', minWidth : 400, minHeight: 150, contents : [ { id : 'main', label : 'Upload', elements : [ { type : 'file', id : 'upload', label : 'Select the image you want to upload', size : 45, validate : CKEDITOR.dialog.validate.notEmpty( 'The file path cannot be empty' ), required : true }, { type : 'fileButton', id : 'uploadButton', label : 'Upload to imgur', 'for' : [ 'main', 'upload' ], filebrowser : { action : 'QuickUpload', params : { type : 'Images', currentFolder : '/folder/' }, onSelect: function ( fileUrl, errorMessage ) { alert( 'The selected file path is ' + fileUrl ); alert( 'This error ocurred' + errorMessage ); } } } ] } ] }; }); } });
Upload images to a remote server
Hi Isuru,
I'm interested by this plugin. Did you get it work? or do you have a more complete version?
Thanks in advances,
simo