ensure there is a thumbnail variant before returning url
This commit is contained in:
@@ -138,9 +138,11 @@ class Media extends Model
|
|||||||
*/
|
*/
|
||||||
public function getThumbnailAttribute(): string
|
public function getThumbnailAttribute(): string
|
||||||
{
|
{
|
||||||
$url = $this->url('thumbnail', true);
|
if($this->hasVariant('thumbnail')) {
|
||||||
if($url !== '') {
|
$url = $this->url('thumbnail', true);
|
||||||
return $url;
|
if($url !== '') {
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$thumbnail = '/thumbnails/' . pathinfo($this->name, PATHINFO_EXTENSION) . '.webp';
|
$thumbnail = '/thumbnails/' . pathinfo($this->name, PATHINFO_EXTENSION) . '.webp';
|
||||||
|
|||||||
Reference in New Issue
Block a user