1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > ueditor修改默认图片保存路径 ueditor根据楼盘ID保存图片路径

ueditor修改默认图片保存路径 ueditor根据楼盘ID保存图片路径

时间:2019-01-10 13:25:24

相关推荐

ueditor修改默认图片保存路径 ueditor根据楼盘ID保存图片路径

原始的图片路径

"imagePathFormat": "/uploads/c_id/image/{yyyy}{mm}{dd}/{time}{rand:6}", "imagePathFormat": "/uploads/image/0207/1612661604861453.jpg",

修改后的图片路径

"imagePathFormat": "/uploads/House/loupan_15/image/0207/1612661604861453.jpg",

1、图片请求地址

/ueditor/index.html?type=house_pic&houseid=15&action=config&&noCache=1612681644609

2、默认图片请求路径所在位置

3、给默认图片请求的路径添加点参数

var arr = window.location.pathname.split('/'); //获取浏览器里面的参数 转成json数组格式//console.log(arr);var hurl='';for (i=0; i < arr.length; i++) {if (arr[i] == 'house_type') {hurl = '?type=house_type';}if (arr[i] == 'house_pic') {hurl = '?type=house_pic';}if (arr[i] == 'house_id') {hurl += '&houseid=' + arr[i + 1].split(".",1);}} //下面那一段serverUrl: 'http://'+window.location.host+"/ueditor/index.html"+hurl

4、PHP部分 Ueditor.php

原始PHP

public function index(){$up = new \ueditor\upload\Upload();$up->pre_fix = false;$up->option();}

修改后的php

public function index(){$up = new \ueditor\upload\Upload();$up->pre_fix = false;$houseid = input('get.houseid');$type = input('get.type');$housePath = $houseid ? '/loupan_' . $houseid : '';$typePath = $type ? '/' . $type : '';$up->c_id = 'House' . $housePath . $typePath; //主要是这一段进行替换$up->option();}

完成版

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。