1.找到uedior/dialogs/image/image.js文件,Add为修改部分的代码:

/**
* tab点击处理事件
* @param tabHeads
* @param tabBodys
* @param obj
*/
function clickHandler(tabHeads, tabBodys, obj) {
//head样式更改
for (var k = 0,
len = tabHeads.length; k < len; k++) {
tabHeads[k].className = "";
}
obj.className = "focus";
//body显隐
var tabSrc = obj.getAttribute("tabSrc");
for (var j = 0,
length = tabBodys.length; j < length; j++) {
var body = tabBodys[j],
id = body.getAttribute("id");
body.onclick = function() {
this.style.zoom = 1;
};
if (id != tabSrc) {
body.style.zIndex = 1;
} else {
body.style.zIndex = 200;
//当切换到本地图片上传时,隐藏遮罩用的iframe
if (id == "local") {
toggleFlash(true);
maskIframe.style.display = "none";
//处理确定按钮的状态
if (selectedImageCount) {
dialog.buttons[0].setDisabled(true);
}
} else {
toggleFlash(false);
maskIframe.style.display = "";
dialog.buttons[0].setDisabled(false);
}
var list = g("imageList");
list.style.display = "none";
//切换到图片管理时,ajax请求后台图片列表
if (id == "imgManager") {
list.style.display = "";
//已经初始化过时不再重复提交请求
if (!list.children.length) {
ajax.request(editor.options.imageManagerUrl, {
timeout: 100000,
action: "get",
onsuccess: function(xhr) {
//去除空格
var tmp = utils.trim(xhr.responseText),
imageUrls = !tmp ? [] : tmp.split("ue_separate_ue"),
length = imageUrls.length;
g("imageList").innerHTML = !length ? " " + lang.noUploadImage: "";
for (var k = 0,ci; ci = imageUrls[k++];) {
//Add Start===============================
var div = document.createElement("div");
var img = document.createElement("img");
var del = document.createElement("img");
var p = document.createElement("p"); div.appendChild(img);
div.appendChild(p);
p.appendChild(del);
div.style.display = "none"; img.style.height = "100px";
img.style.width = "100px";
del.setAttribute("src", "images/del.png");
p.style.marginTop = "-104px";
p.style.marginLeft = "90px"; g("imageList").appendChild(div);
img.onclick = function() {
changeSelected(this);
}; del.onclick = function() {
var me = this,
src = me.getAttribute("alt", 2);
var pic = me.parentNode.parentNode.childNodes[0];
if (!confirm("删除操作不可恢复,您确认要删除本图片么?")) return;
ajax.request(editor.options.imageManagerUrl, {
action: "del",
fileName: src.substr(src.lastIndexOf("/") + 1),
onsuccess: function(xhr) {
me.parentNode.parentNode.removeChild(pic);
me.parentNode.removeChild(me);
},
onerror: function(xhr) {
alert("服务器删除图片失败,请重试!");
}
});
};
//Add End================================
img.onload = function() {
this.parentNode.style.display = "";
var w = this.width,
h = this.height;
scale(this, 100, 120, 80);
this.title = lang.toggleSelect + w + "X" + h;
this.onload = null;
};
img.setAttribute(k < 35 ? "src": "lazy_src", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
img.setAttribute("title", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
img.setAttribute("width", "100px");
img.setAttribute("height", "100px"); del.onload = function() { //设置加载del图片时的样式
this.style = "border:0";
this.onload = null;
};
del.setAttribute("alt", editor.options.imageManagerPath + ci.replace(/\s+|\s+/ig, ""));
}
},
onerror: function() {
g("imageList").innerHTML = lang.imageLoadError;
}
});
}
}
if (id == "imgSearch") {
selectTxt(g("imgSearchTxt"));
}
if (id == "remote") {
$focus(g("url"));
}
}
}
}

找到uedior/php/imageManager.php文件,增加以下内容:

if ($action == "del") {
$fileName = $_POST['fileName'];
foreach($paths as $path) {
$str1 = delfiles($fileName, $path);
break;
}
} function delfiles($fileName, $path, &$files = array()) {
if (!is_dir($path)) return null;
$handle = opendir($path);
while (false !== ($file = readdir($handle))) {
if ($file != '.' && $file != '..') {
$path2 = $path.'/'.$file;
if (is_dir($path2)) {
delfiles($fileName, $path2, $files);
} else {
if (preg_match("/\.(gif|jpeg|jpg|png|bmp)$/i", $file)) {
$path3 = str_replace('../../', '/static/', $path2);
$fileImg = basename($path3);
if ($fileImg == $fileName) {
$is_del = unlink($path2);
}
}
}
}
}
}

php版给UEditor的图片在线管理栏目增加图片删除功能的更多相关文章

  1. jsp版ueditor图片在线管理返回绝对路径

    引用:http://zhengyunfei.iteye.com/blog/2149979 如果你有富文本编辑器的功能需要开发,我推荐你用百度的ueditor.本文将与你分享jsp版ueditor开发中 ...

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

    使用ueditor,点击在线管理,服务器图片路径显示不正确,如下图所示  查看源码,如下:  发现图片src中中间多了一长串的项目跟路径,解决的办法是 把  jsp/controller.jsp 里面 ...

  3. Ueditor结合七牛云存储上传图片、附件和图片在线管理的实现和最新更新

    最新下载地址: https://github.com/widuu/qiniu_ueditor_1.4.3 Ueditor七牛云存储版本 注意事项 老版本请查看 : https://github.com ...

  4. UEditor1.4.3.3实现图片上传、删除功能

    1.下载ueditor1.4.3.3 UTF-8的版本 2.新建一个项目,在项目中添加UEditor,把下载好的插件都放在ueditor这个文件夹中,在进行一些基本的配置 3.在根目录下新建一个为in ...

  5. C#设计模式总结 C#设计模式(22)——访问者模式(Vistor Pattern) C#设计模式总结 .NET Core launch.json 简介 利用Bootstrap Paginator插件和knockout.js完成分页功能 图片在线裁剪和图片上传总结 循序渐进学.Net Core Web Api开发系列【2】:利用Swagger调试WebApi

    C#设计模式总结 一. 设计原则 使用设计模式的根本原因是适应变化,提高代码复用率,使软件更具有可维护性和可扩展性.并且,在进行设计的时候,也需要遵循以下几个原则:单一职责原则.开放封闭原则.里氏代替 ...

  6. ueditor1.4.3jsp版成功上传图片后却回显不出来与在线管理显示不出图片的解决方案

    这是因为路径问题,可以在jsp/config.json这个文件去改路径 通过“imageUrlPrefix”与“imagePathFormat”这两个属性去拼凑路径. “imageUrlPrefix” ...

  7. dedecmsV5.7 百度编辑器ueditor 多图上传 在线管理 排序问题

    问题:dedecms后台百度编辑器ueditor的多图上传-在线管理的图片排序有问题,想把这个顺序调成按照文件修改时间倒序来展示 解决方法: 1.打开/include/ueditor/php/acit ...

  8. 使用uEdit时,在线管理图片功能不可用

    把所有的配置文件都配置好了,uedit的在线管理功能图片还是不可用,看了一下源码: 是的,它在img的src属性后边的图片上加上了参数,那肯定不能用啊,所以修改源文件image.js.直接搜索noCa ...

  9. .NET下为百度文本编辑器UEditor增加图片删除功能

    [摘要:比来写了个项目,用到了UEditor,但是UE并出有文件删除功效 然后网上找若何增加 找半天只能找到一个1.2.X的 以是便摹仿PHP的 改成了.NET的 PHP本文 第一步 (增加背景删除地 ...

随机推荐

  1. MyBatis动态传入表名,字段名参数的解决办法---statementType用法

    statementType="STATEMENT" 要实现动态传入表名.列名,需要做如下修改 添加属性statementType="STATEMENT" 同时s ...

  2. linux命令-bzip2压缩

    gzip和bzip2 都是压缩命令  区别是压缩算法不一样  一般bzip2压缩的效率高  都不能压缩目录 bzip2 压缩 [root@wangshaojun ~]# bzip2 install.l ...

  3. shell入门-uniq去重复和tee重定向

    命令:uniq 选项:-c 显示重复数量 说明:去重复,不sort多个功能,显示几个重复 命令:tee 说明:重定向加上双重输出 [root@wangshaojun ~]# cat 2.txt1222 ...

  4. Maven jenkins +Jmeter自动化测试

    Maven jenkins +Jmeter自动化测试 1. Jenkins中集成jmeter-maven插件 http://my.oschina.net/u/1377774/blog/168969 2 ...

  5. 华为USG6320做双线-基于源地址的策略路由

    通过配置策略路由实现不同源地址数据通过不同的链路转发. 组网需求 某企业公司拉了两条电信的光纤,分别为静态光纤和拨号光纤,前者主要用于服务器,后者则用于一般办公. 需求如下: 静态光纤:服务器专用 拨 ...

  6. df查看分区使用情况

    Linux df命令用于显示目前在Linux系统上的文件系统的磁盘使用情况统计.语法 df [选项]... [FILE]...     -a, --all 包含所有的具有 0 Blocks 的文件系统 ...

  7. NEKOGAMES

    http://bbs.3dmgame.com/thread-4133434-1-1.html

  8. Spring5.0的第一次尝鲜

    对于这次尝鲜,说白了和Spring5.0的新特性基本没有多大的关系,如果说您不小心进来了,却发发现文章的内容和标题似乎不太匹配,那么我将是非常的抱歉,因为这浪费了您宝贵的时间.但是我还是要说:因为这确 ...

  9. Blast 如何使用Blast+(Linux)转载

    下载数据 #此处下载对应物种的数据库ftp://ftp.ncbi.nih.gov/genomes/,下载fna格式的即可   wget ftp://ftp.ncbi.nih.gov/genomes/A ...

  10. java单链表反转

    今天做leetcode,遇到了单链表反转.研究了半天还搞的不是太懂,先做个笔记吧 参考:http://blog.csdn.net/guyuealian/article/details/51119499 ...