解决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 );
- %>
- /* 列出指定目录下的图片 */
- "imageManagerActionName": "listimage", /* 执行图片管理的action名称 */
- "imageManagerListPath": "/ueditor/jsp/upload/image/", /* 指定要列出图片的目录 */
- "imageManagerListSize": 20, /* 每次列出文件数量 */
- "imageManagerUrlPrefix": "/ueditor", /* 图片访问路径前缀 */
- "imageManagerInsertAlign": "none", /* 插入的图片浮动方式 */
- "imageManagerAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 列出的文件类型 */
在线管理图片马上就显示出来了,如下图
相关推荐
- PHP图片验证码无法显示的解决方案
- intellij IDE build出错,无法显示图片,找不到tomcat server,java编译版本过低,异常推出后无法启动项目等常见问题解决
- 解决 Windows 照片查看器无法显示此图片,因为计算机上的可用内存可能不足
- 解决 Windows 照片查看器无法显示此图片,因为计算机上的可用内存可能不足
- github的README.md如何上传图片以及解决图片无法显示
- 解决:Hexo安装abbrlink插件后asset-image无法显示图片
- 无法在Jpannel中显示图片问题的解决办法
- IE浏览器图片不显示,报DOM7009: 无法解码 URL 处的图像问题的解决方法
- PHP用户登录界面验证码显示为“X”(验证码图片无法显示)解决办法
- Dialog无法显示图片问题及解决方案
- Android图片缓存
- 如何判断当前系统使用了share memory作为design layer processing