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

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



 查看源码,如下:



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

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

<%@ page language="java" contentType="text/html; charset=UTF-8"
 
    import="com.baidu.ueditor.ActionEnter"
 
    pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%
request.setCharacterEncoding( "utf-8" );
response.setHeader("Content-Type" , "text/html");
 
String rootPath = application.getRealPath( "/" );
 
String action = request.getParameter("action");
String result = new ActionEnter( request, rootPath ).exec();
if( action!=null && 
   (action.equals("listfile") || action.equals("listimage") ) ){
    rootPath = rootPath.replace("\\", "/");
    result = result.replaceAll(rootPath, "/");
}
out.write( result );
%>
然后改config.json

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


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


  • 6
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值