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"'))
}
}
}
}
);
}
