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;