kindeditor 图片上传后生成带域名绝对路径配置方法

2016-12-11 17:59 阅读 4,313 次 评论 0 条

kindeditor默认上传图是不带域名域名绝对路径了,如果我们希望生成之后带上域名就需要进入urlType进行设置了,我们kindeditor中的urlType有几个参数默认这空值”“、”relative”、”absolute”、”domain”了。

关键在于初始化kindeditor时指定以下参数:

urlType
”“ 空为不修改URL
”relative” 相对路径
”absolute” 绝对路径
”domain” 带域名的绝对路径。

例子:

代码如下:

htmlEditor = K.create(
'#content',
{
uploadJson : '../kindeditor/jsp/upload_json.jsp',
fileManagerJson : '../kindeditor/jsp/file_manager_json.jsp',
height : 300,
width : '90%',
// fontSizeTable:['21px','20px','17px','18px','16px','14px','12px'],
resizeType : 0,//1
allowPreviewEmoticons : true,
allowImageUpload : true,
urlType:'domain'
});

后面在另一个网站看到另一个方法

<script>
KindEditor.ready(function(K) {
var editor1 = K.create('textarea[name="content"]', {
cssPath : '/assets/kindeditor/plugins/code/prettify.css',
uploadJson : '/assets/kindeditor/php/upload_json.php',
fileManagerJson : '/assets/kindeditor/php/file_manager_json.php',
urlType:'domain',
allowFileManager : true,
afterCreate : function() {
var self = this;
K.ctrl(document, 13, function() {
self.sync();
K('form[name=andNews]')[0].submit();
});
K.ctrl(self.edit.doc, 13, function() {
self.sync();
K('form[name=andNews]')[0].submit();
});
}
});
prettyPrint();
});
</script>
版权声明:本文著作权归原作者所有,欢迎分享本文,谢谢支持!
转载请注明:kindeditor 图片上传后生成带域名绝对路径配置方法 | 雨晨博客

发表评论


表情