Update Media model, fix thumbnail cdn paths

This commit is contained in:
Daniel Supernault 2022-10-03 04:23:18 -06:00
parent b8ad594a05
commit 9888af120a
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7
1 changed files with 4 additions and 0 deletions

View File

@ -56,6 +56,10 @@ class Media extends Model
return url(Storage::url($this->thumbnail_path));
}
if($this->remote_media && !$this->thumbnail_path && $this->cdn_url) {
return $this->cdn_url;
}
if($this->media_path && $this->mime && in_array($this->mime, ['image/jpeg', 'image/png'])) {
return $this->remote_media || Str::startsWith($this->media_path, 'http') ?
$this->media_path :