1.后台图片上传路径/Public/kindeditor/php/upload_json.php;
2.createHtml方法改为如下:
function createHtml(){ editor = KindEditor.create('#content{$nodeType}', { safeMode: true, resizeType: 1, allowFileManager: true, allowPreviewEmoticons: false, items: [ 'source','fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline', 'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', 'insertunorderedlist', 'image', 'multiimage'], afterUpload : function(url, data, name) { //上传文件后执行的回调函数,必须为3个参数 if(name=="image" || name=="multiimage"){ //单个和批量上传图片时 var img = new Image(); img.src = url; img.onload = function(){ //图片必须加载完成才能获取尺寸 if(img.width>330) editor.html(editor.html().replace('<img src="' + url + '"','<img src="' + url + '" width="330"')) } } } } ); }