最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

UEditor编辑器上传图片开发流程_html/css_WEB-ITnose

来源:动视网 责编:小采 时间:2020-11-27 16:15:10
文档

UEditor编辑器上传图片开发流程_html/css_WEB-ITnose

UEditor编辑器上传图片开发流程_html/css_WEB-ITnose:在ueditor目录下找到uedior.config.js,找到如下三行: 1 ,imageUrl: /controller.json //图片上传提交后台对应的地址,路径固定为*/controller.*2 ,imagePath: /ueditor/ //图片在服务器上的存储目录3 ,imageFieldNam
推荐度:
导读UEditor编辑器上传图片开发流程_html/css_WEB-ITnose:在ueditor目录下找到uedior.config.js,找到如下三行: 1 ,imageUrl: /controller.json //图片上传提交后台对应的地址,路径固定为*/controller.*2 ,imagePath: /ueditor/ //图片在服务器上的存储目录3 ,imageFieldNam


在ueditor目录下找到uedior.config.js,找到如下三行:

1 ,imageUrl: "<%=path %>/controller.json" //图片上传提交后台对应的地址,路径固定为*/controller.*2 ,imagePath: "<%=path %>/ueditor/" //图片在服务器上的存储目录3 ,imageFieldName: "upload" //后台对应接收image的参数名

或者:

var ueditor = UE.getEditor('myEditor',{ imageUrl: "<%=path %>/servlet/UploadServlet", //图片上传提交后台对应的地址 imagePath: "<%=path %>/ueditor/", //图片在服务器上的存储目录 imageFieldName: "upload" //后台对应接收image的参数名});

注意:记得在uedior.config.js配置文件中把"serverUrl"注释掉

在/ueditor/_src/plugins/simpleupload.js文件中,把link = me.options.imageUrlPrefix + json.url; 改为link = getRootPath()+json.url;

最后配置服务器返回的数据格式,这需要这服务器端进行修改。对应于后台接收上传图片的那个controller,返回的格式需如下:

{'url':'60391393848223.jpg','title':'p1999637039.jpg','original':'p1999637039.jpg','state':'SUCCESS'}

注意:url用相对路径,这样就OK了。

//js获取项目根路径,如: http://localhost:8083/uimcardprjfunction getRootPath(){ //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp var curWwwPath=window.document.location.href; //获取主机地址之后的目录,如: uimcardprj/share/meun.jsp var pathName=window.document.location.pathname; var pos=curWwwPath.indexOf(pathName); //获取主机地址,如: http://localhost:8083 var localhostPaht=curWwwPath.substring(0,pos); //获取带"/"的项目名,如:/uimcardprj var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); //return localhostPaht + projectName; return localhostPaht+"/";}

文档

UEditor编辑器上传图片开发流程_html/css_WEB-ITnose

UEditor编辑器上传图片开发流程_html/css_WEB-ITnose:在ueditor目录下找到uedior.config.js,找到如下三行: 1 ,imageUrl: /controller.json //图片上传提交后台对应的地址,路径固定为*/controller.*2 ,imagePath: /ueditor/ //图片在服务器上的存储目录3 ,imageFieldNam
推荐度:
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top