KindEditor图片上传路径问题
一、需求
通过wordpress下的kindeditor插件自带的图片上传功能实现带标签的链接。即由/wp-content/uploads/2015/03/test.jpg
更改为http://img.361way.com/2015/03/test.jpg
。
二、调整
1、由相对URL更改为绝对URL
1<img alt="" decoding="async" src="/wp-content/uploads/2015/03/test.jpg"></img>
2更改为
3<img alt="" decoding="async" src="http://img.361way.com/2015/03/test.jpg"></img>
进入wp-content/plugins/kindeditor-for-wordpress插件目录,修改upload_json.php文件改如下两部分:
文件保存目录路径
1$save_path = $php_path . '../../../uploads/';
2更改为
3$save_path = '/data1/img';
文件保存目录URL
1$save_url = $php_url . 'uploads/';
2更改为
3$save_url = 'http://img.91it.org/';
2、增加链接标签
上传增加<a></a>
引用标签,
1<img alt="" decoding="async" src="http://img.361way.com/2015/03/test.jpg"></img>
2更改为
3<a href="http://img.361way.com/2015/03/test.jpg"><img alt="" decoding="async" src="http://img.361way.com/2015/03/test.jpg"></img></a>
修改:wp-content/plugins/kindeditor-for-wordpress/kindeditor.js文件,insertimage:function(a,b,c,d,e,g)部分:
1108行左右
2‘![]('+ C(a)+')<img src=”‘+ C(a)+'” data-ke-src=”‘+C(a)+'” ‘
3a+=’alt=”‘+C(b)+'” ‘;a+=”/>”
4更改为
5a+=’alt=”‘+C(b)+'” ‘;a+=”/>“
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/kindeditor-img-upload-path/4195.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.