Add missing thumbnail fallback

pull/949/head
Daniel Supernault 2019-03-03 22:39:52 -07:00
rodzic 58696aac9f
commit 03a4bb8d80
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 0DEF1C662C9033F7
4 zmienionych plików z 4 dodań i 5 usunięć

Wyświetl plik

@ -41,10 +41,8 @@ class Media extends Model
public function thumbnailUrl()
{
$path = $this->thumbnail_path;
$url = Storage::url($path);
return url($url);
$path = $this->thumbnail_path ?? 'public/no-preview.png';
return url(Storage::url($path));
}
public function thumb()

Wyświetl plik

@ -80,7 +80,7 @@ class Status extends Model
$type = $this->type ?? $this->setType();
$is_nsfw = !$showNsfw ? $this->is_nsfw : false;
if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['photo', 'photo:album'])) {
return 'data:image/gif;base64,R0lGODlhAQABAIAAAMLCwgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
return url(Storage::url('public/no-preview.png'));
}
return url(Storage::url($this->firstMedia()->thumbnail_path));

Wyświetl plik

@ -1,2 +1,3 @@
*
!.gitignore
!no-preview.png

Plik binarny nie jest wyświetlany.

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.1 KiB