fix a bug

This commit is contained in:
Wisp X
2022-03-14 11:44:54 +08:00
parent 985af20b5b
commit bcffb4c8fc
+3 -2
View File
@@ -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);
});
}