From 77b3167d36524c8689a49cab539d0b76b46632ae Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Mon, 31 Oct 2022 17:51:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20placeholder=20=E8=A2=AB?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- beike/Services/ImageService.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beike/Services/ImageService.php b/beike/Services/ImageService.php index 9e6713dd..0d36bd0a 100644 --- a/beike/Services/ImageService.php +++ b/beike/Services/ImageService.php @@ -68,6 +68,10 @@ class ImageService public function resize(int $width = 100, int $height = 100): string { try { + if (!file_exists($this->imagePath)) { + return ''; + } + $extension = pathinfo($this->imagePath, PATHINFO_EXTENSION); $newImage = 'cache/' . mb_substr($this->image, 0, mb_strrpos($this->image, '.')) . '-' . $width . 'x' . $height . '.' . $extension;