From 3706a9209d8cb7c3f22c65e40df5c0f8776ed9a7 Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Sat, 23 Oct 2021 17:00:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E9=99=84=E4=BB=B6=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E7=BB=98=E5=88=B6=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../view/default/site/attachment/index.html | 14 ------ extend/base/Uploader.php | 49 +------------------ 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/app/admin/view/default/site/attachment/index.html b/app/admin/view/default/site/attachment/index.html index c9cb225b0..79b1f356e 100644 --- a/app/admin/view/default/site/attachment/index.html +++ b/app/admin/view/default/site/attachment/index.html @@ -36,20 +36,6 @@ - -
- - -
- -

1. 默认否、建议开启上传图片重新绘制、防止木马病毒图片上传

-

2. 开启后gif动态图片将失效、由于重新绘制图片大小也会改变

-
-
diff --git a/extend/base/Uploader.php b/extend/base/Uploader.php index f7419a5f6..b642c96ab 100755 --- a/extend/base/Uploader.php +++ b/extend/base/Uploader.php @@ -237,55 +237,8 @@ class Uploader return; } - // 如未安装相应的gd库则直接存储文件 - // 未开启重新绘制 - $is_move = false; - - // 是否开启图片重新绘制 - if(MyC('is_upload_images_redraw', 0) == 1) - { - switch($this->fileType) - { - case '.png': - if(function_exists('imagecreatefrompng')) - { - $image = imagecreatefrompng($file["tmp_name"]); //PNG - imagesavealpha($image, true); //这里很重要 意思是不要丢了$sourePic图像的透明色; - $width = imagesx($image); //图宽度 - $heigh = imagesy($image); //图高度 - $thumb = imagecreatetruecolor($width, $heigh); - imagealphablending($thumb, false); //这里很重要,意思是不合并颜色,直接用$img图像颜色替换,包括透明色; - imagesavealpha($thumb, true); //这里很重要,意思是不要丢了$thumb图像的透明色; - if(imagecopyresampled($thumb, $image, 0, 0, 0, 0, $width, $heigh, $width, $heigh)) - { - imagepng($thumb, $this->filePath); - } - } else { - $is_move = true; - } - break; - case '.gif': - if(function_exists('imagecreatefromgif')) - { - @imagegif(@imagecreatefromgif($file["tmp_name"]), $this->filePath); - } else { - $is_move = true; - } - break; - default: - if(function_exists('imagecreatefromjpeg')) - { - @imagejpeg(@imagecreatefromjpeg($file["tmp_name"]), $this->filePath, 100); - } else { - $is_move = true; - } - } - } else { - $is_move = true; - } - // 是否需要直接存储文件 - if($is_move && !move_uploaded_file($file["tmp_name"], $this->filePath)) + if(!move_uploaded_file($file["tmp_name"], $this->filePath)) { $this->stateInfo = $this->getStateInfo("ERROR_FILE_MOVE"); } -- GitLab