Ueditor图片上传设置(1.4.3 JSP版本)
来源:互联网 发布:数据库用什么语言 编辑:程序博客网 时间:2024/05/16 06:11
最近研究了一下Ueditor,发现图片上传功能不能直接使用,需要修改一些东西,记下来以备参考。
1. 修改com.baidu.ueditor.hunter.FileManager类下的一个方法,修改如下:
源代码:
private String getPath ( File file ) {
String path = file.getAbsolutePath();
return path.replace( this.rootPath, "/" );
}
修改为:
private String getPath ( File file ) {
String path = file.getAbsolutePath();
String str=path.replace(this.rootPath.replaceAll("\\/", "\\\\"), "\\" );
return str;
}
(此处如果不修改,会导致“在线管理”下的图片不能显示)
2. 修改image.js文件,有两处的图片地址设置有问题,这里导致的问题是上传的图片在编辑器中不能显示图片。
(1):需要自定义一个方法,获取当前项目的地址(方法比较笨,可自行修改)
function getRootPath(){
//获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp
var curWwwPath=window.document.location.href;
var pathName=window.document.location.pathname;
var pos=curWwwPath.indexOf(pathName);
var localhostPaht=curWwwPath.substring(0,pos);
var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1);
return localhostPaht + projectName;
}
(2)分别在以下两个地方添加刚才获取的项目地址
约775行:
src: getRootPath() + prefix + data.url,
_src: getRootPath() + prefix + data.url,
约912行
img.setAttribute('src', getRootPath() + urlPrefix + list[i].url + (list[i].url.indexOf('?') == -1 ? '?noCache=':'&noCache=') + (+new Date()).toString(36) );
img.setAttribute('_src', getRootPath() + urlPrefix + list[i].url);
- Ueditor图片上传设置(1.4.3 JSP版本)
- Ueditor图片上传设置(1.4.3 JSP版本)
- Ueditor图片上传设置(1.4.3 JSP版本) - 解决图片不能显示问题
- Ueditor JSP 图片上传
- ueditor编辑器图片上传添加水印-jsp版本
- UEditor 图片上传路径设置
- ueditor上传图片到服务器再次上传到OSS jsp版本
- UEditor 1.4.2+版本文件图片上传路径配置
- ueditor 1.4.3 图片上传配置注意事项
- 百度ueditor 1.4.3 jsp开发版简单配置及图片上传
- ueditor的图片上传(jsp)
- 利用工具类为ueditor上传图片添加水印(JSP版本)
- Ueditor设置虚拟路径上传图片详解
- UEditor配置:图片上传和文件上传独立使用方法,兼容最新版 UEditor 1.4.3
- UEditor配置:图片上传和文件上传独立使用方法,兼容最新版 UEditor 1.4.3
- UEditor配置:图片上传和文件上传独立使用方法,兼容最新版 UEditor 1.4.3
- UEditor (JSP 1.4.3版本) 集成到ssh框架中
- UEditor (JSP 1.4.3版本) 集成到ssh框架中
- [Ovject-c] 文件处理 (一) plist文件
- Csharp调用微软COM转换word为HTML
- 黑马程序员——String类详解
- Dijkstra算法求任意点到其它点的最短路径
- 面试技巧之群面
- Ueditor图片上传设置(1.4.3 JSP版本)
- POJ 2431 Expedition(贪心)
- Lua的类型与值
- linux 信号屏蔽
- 新版ADT创建项目时出现appcompat_v7\bin(missing),ppcompat_v7/gen(missing)的问题
- mysql查询优化
- 利用栈写的一个支持四则运算的计算器
- js 字符串中某字符被全部替换
- silverlight根据json字符串动态创建实体类