From bcffb4c8fc2eac5cca251b36e895eeeeaf4df887 Mon Sep 17 00:00:00 2001 From: Wisp X <1591788658@qq.com> Date: Mon, 14 Mar 2022 11:44:54 +0800 Subject: [PATCH] fix a bug --- app/Models/Image.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Models/Image.php b/app/Models/Image.php index ba8379fb..12cd25fb 100644 --- a/app/Models/Image.php +++ b/app/Models/Image.php @@ -184,13 +184,14 @@ class Image extends Model return new Attribute(function () { $path = trim(env('THUMBNAIL_PATH', 'thumbnails'), '/'); + $pathname = $path."/{$this->md5}.png"; // 没有缩略图则返回原图 - if (! file_exists($path)) { + if (! file_exists(public_path($pathname))) { return $this->url; } - return asset($path."/{$this->md5}.png"); + return asset($pathname); }); }