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

使用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"], /* 列出的文件类型 */  


在线管理图片马上就显示出来了,如下图


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值