首页 > 其他 > 详细

解决ueditor编辑器图片在线管理图片无法显示

时间:2017-10-11 10:23:40      阅读:366      评论:0      收藏:0      [点我收藏+]

使用ueditor,点击在线管理,服务器图片路径显示不正确,如下图所示


技术分享
 查看源码,如下:


技术分享
 发现图片src中中间多了一长串的项目跟路径,解决的办法是

把  jsp/controller.jsp 里面的代码修改一下

 

[java] view plain copy
  1. <%@ page language="java" contentType="text/html; charset=UTF-8"  
  2.    
  3.     import="com.baidu.ueditor.ActionEnter"  
  4.    
  5.     pageEncoding="UTF-8"%>  
  6. <%@ page trimDirectiveWhitespaces="true" %>  
  7. <%  
  8. request.setCharacterEncoding( "utf-8" );  
  9. response.setHeader("Content-Type" , "text/html");  
  10.    
  11. String rootPath = application.getRealPath( "/" );  
  12.    
  13. String action = request.getParameter("action");  
  14. String result = new ActionEnter( request, rootPath ).exec();  
  15. if( action!=null &&   
  16.    (action.equals("listfile") || action.equals("listimage") ) ){  
  17.     rootPath = rootPath.replace("\\", "/");  
  18.     result = result.replaceAll(rootPath, "/");  
  19. }  
  20. out.write( result );  
  21. %>  

然后改config.json

 

 

[java] view plain copy
  1. /* 列出指定目录下的图片 */  
  2.    "imageManagerActionName": "listimage", /* 执行图片管理的action名称 */  
  3.    "imageManagerListPath": "/ueditor/jsp/upload/image/", /* 指定要列出图片的目录 */  
  4.    "imageManagerListSize": 20, /* 每次列出文件数量 */  
  5.    "imageManagerUrlPrefix": "/ueditor", /* 图片访问路径前缀 */  
  6.    "imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */  
  7.    "imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */  

解决ueditor编辑器图片在线管理图片无法显示

原文:http://www.cnblogs.com/justuntil/p/7648854.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!