原始的图片路径
"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();}
完成版