From 2e03cee7267d0594ac64fe5522b71bd9ec7231cb Mon Sep 17 00:00:00 2001 From: kuaifan Date: Fri, 20 May 2022 10:22:38 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=B8=8A=E4=BC=A0=E6=88=96=E5=8F=91?= =?UTF-8?q?=E9=80=81=E5=9B=BE=E7=89=87=E5=A4=AA=E5=A4=A7=E6=97=B6=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/WebSocketDialogMsg.php | 9 +++++++++ resources/assets/js/components/PreviewImage/view.vue | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Models/WebSocketDialogMsg.php b/app/Models/WebSocketDialogMsg.php index 7106c39d9..2a67ca38d 100644 --- a/app/Models/WebSocketDialogMsg.php +++ b/app/Models/WebSocketDialogMsg.php @@ -256,6 +256,9 @@ class WebSocketDialogMsg extends AbstractModel $tmpPath .= md5s($base64) . "." . $matchs[1][$key]; if (file_put_contents(public_path($tmpPath), base64_decode($base64))) { $imagesize = getimagesize(public_path($tmpPath)); + if (Base::imgThumb(public_path($tmpPath), public_path($tmpPath) . "_thumb.jpg", 320, 0)) { + $tmpPath .= "_thumb.jpg"; + } $text = str_replace($matchs[0][$key], "[:IMAGE:browse:{$imagesize[0]}:{$imagesize[1]}:{$tmpPath}::]", $text); } } @@ -277,6 +280,9 @@ class WebSocketDialogMsg extends AbstractModel $tmpPath .= md5s($str) . "." . $matchs[3][$key]; if (file_exists(public_path($tmpPath))) { $imagesize = getimagesize(public_path($tmpPath)); + if (Base::imgThumb(public_path($tmpPath), public_path($tmpPath) . "_thumb.jpg", 320, 0)) { + $tmpPath .= "_thumb.jpg"; + } $text = str_replace($matchs[0][$key], "[:IMAGE:browse:{$imagesize[0]}:{$imagesize[1]}:{$tmpPath}::]", $text); } else { $image = file_get_contents($str); @@ -284,6 +290,9 @@ class WebSocketDialogMsg extends AbstractModel $text = str_replace($matchs[0][$key], "[:IMAGE:browse:90:90:images/other/imgerr.jpg::]", $text); } else if (file_put_contents(public_path($tmpPath), $image)) { $imagesize = getimagesize(public_path($tmpPath)); + if (Base::imgThumb(public_path($tmpPath), public_path($tmpPath) . "_thumb.jpg", 320, 0)) { + $tmpPath .= "_thumb.jpg"; + } $text = str_replace($matchs[0][$key], "[:IMAGE:browse:{$imagesize[0]}:{$imagesize[1]}:{$tmpPath}::]", $text); } } diff --git a/resources/assets/js/components/PreviewImage/view.vue b/resources/assets/js/components/PreviewImage/view.vue index 441bfa36e..d32e312f8 100644 --- a/resources/assets/js/components/PreviewImage/view.vue +++ b/resources/assets/js/components/PreviewImage/view.vue @@ -208,7 +208,7 @@ export default { return this.index === this.urlList.length - 1; }, currentImg() { - return this.urlList[this.index]; + return $A.rightDelete(this.urlList[this.index], "_thumb.jpg"); }, imgStyle() { const {scale, deg, offsetX, offsetY, enableTransition} = this.transform;