zoukankan      html  css  js  c++  java
  • 解决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"], /* 列出的文件类型 */  
  • 相关阅读:
    IE hack [if IE]解决IE CSS 兼容问题
    jQuery重要插件、JS辅助工具
    几个jQueryUI框架
    推荐书籍
    Win7下用原生的ie6调试网页
    Code First :使用Entity. Framework编程(3)
    Code First :使用Entity. Framework编程(6)
    JSON数据格式转换
    Code First :使用Entity. Framework编程(5)
    Code First :使用Entity. Framework编程(4)
  • 原文地址:https://www.cnblogs.com/justuntil/p/7648854.html
Copyright © 2011-2022 走看看