在线涂改图片 php,php UEditor如何实现删除图片功能

在线涂改图片 php,php UEditor如何实现删除图片功能phpueditor删除图片的实现方法:首先找到“uedior/dialogs/image/image.js”文件并修改Add内容;然后打开“mageManager.php”文件并添加内容为“functiondelfile()”即可。php版给UEditor的图片在线管理栏目增加图片删除功能1.找到uedior/dialogs/image/image.js文件,Add为修改部分的代码:/***…

大家好,又见面了,我是你们的朋友全栈君。如果您正在找激活码,请点击查看最新教程,关注关注公众号 “全栈程序员社区” 获取激活教程,可能之前旧版本教程已经失效.最新Idea2022.1教程亲测有效,一键激活。

Jetbrains全系列IDE使用 1年只要46元 售后保障 童叟无欺

php ueditor删除图片的实现方法:首先找到“uedior/dialogs/image/image.js”文件并修改Add内容;然后打开“mageManager.php”文件并添加内容为“function delfile()”即可。

7cfec1a3cd57b67eaad8b475f0664d25.png

php版给UEditor的图片在线管理栏目增加图片删除功能

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);

}

}

}

}

}

}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/196384.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • NSGA2 算法Matlab实现「建议收藏」

    NSGA2 算法Matlab实现「建议收藏」为了能随时了解Matlab主要操作及思想。故本文贴上NSGA-Ⅱ算法Matlab实现(测试函数为ZDT1)。更多内容访问omegaxyz.comNSGA-Ⅱ就是在第一代非支配排序遗传算法的基础上改进而来,其改进主要是针对如上所述的三个方面:①提出了快速非支配排序算法,一方面降低了计算的复杂度,另一方面它将父代种群跟子代种群进行合并,使得下一代的种群从双倍的空间中进行选取,从而保留了

    2022年5月19日
    37
  • 卷积神经网络CNN(1)——图像卷积与反卷积(后卷积,转置卷积)

    卷积神经网络CNN(1)——图像卷积与反卷积(后卷积,转置卷积)1.前言  传统的CNN网络只能给出图像的LABLE,但是在很多情况下需要对识别的物体进行分割实现endtoend,然后FCN出现了,给物体分割提供了一个非常重要的解决思路,其核心就是卷积与反卷积,所以这里就详细解释卷积与反卷积。  对于1维的卷积,公式(离散)与计算过程(连续)如下,要记住的是其中一个函数(原函数或者卷积函数)在卷积前要翻转180度图1  对…

    2022年6月21日
    30
  • python安装不了whl文件_Python安装whl文件过程图解

    python安装不了whl文件_Python安装whl文件过程图解Python安装whl文件过程图解这篇文章主要介绍了Python安装whl文件过程图解,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下在命令指示符下(cmd)的Python3安装命令为:pip3install文件名.whl安装出错:matplotlib-2.0.0-cp34-cp34m-win_amd64.whlisnotasuppor…

    2022年5月29日
    67
  • html5网页设计案例课堂_优秀PPT案例

    html5网页设计案例课堂_优秀PPT案例12个优秀的HTML5网站设计案例欣赏欣赏地址:12个优秀的HTML5网站设计案例欣赏

    2022年10月22日
    0
  • WinRAR去广告:只需六步,教你去除WinRAR的广告[通俗易懂]

    WinRAR去广告:只需六步,教你去除WinRAR的广告[通俗易懂]最简单的WinRAR去广告步骤1.下载ResourceHacker地址:ResourceHacker下载地址2.用软件打开WinRAR.exe3.打开StringTable4.打开80:20525.删除1277所在整行,点击运行,然后另存为6.将另存为的WinRAR替换掉原来的将新生成的exe文件仍然命名为WinRAR.exe(我把原来的winrar改名为WinRAR_backup.exe作为备份了)7.大功告成,广告去除了…

    2022年4月27日
    47
  • 关于图像特征提取

     网上发现一篇不错的文章,是关于图像特征提取的,给自己做的项目有点类似,发出来供大家参考。      特征提取是计算机视觉和图像处理中的一个概念。它指的是使用计算机提取图像信息,决定每个图像的点是否属于一个图像特征。特征提取的结果是把图像上的点分为不同的子集,这些子集往往属于孤立的点、连续的曲线或者连续的区域。特征的定义       至今为止特征没有万能和精确的定义。特征的精确定义往往

    2022年4月9日
    38

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号