mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 13:33:18 +00:00
Merge pull request #949 from pixelfed/frontend-ui-refactor
Add missing thumbnail fallback
This commit is contained in:
commit
983b48de51
4 changed files with 4 additions and 5 deletions
|
@ -41,10 +41,8 @@ class Media extends Model
|
||||||
|
|
||||||
public function thumbnailUrl()
|
public function thumbnailUrl()
|
||||||
{
|
{
|
||||||
$path = $this->thumbnail_path;
|
$path = $this->thumbnail_path ?? 'public/no-preview.png';
|
||||||
$url = Storage::url($path);
|
return url(Storage::url($path));
|
||||||
|
|
||||||
return url($url);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function thumb()
|
public function thumb()
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Status extends Model
|
||||||
$type = $this->type ?? $this->setType();
|
$type = $this->type ?? $this->setType();
|
||||||
$is_nsfw = !$showNsfw ? $this->is_nsfw : false;
|
$is_nsfw = !$showNsfw ? $this->is_nsfw : false;
|
||||||
if ($this->media->count() == 0 || $is_nsfw || !in_array($type,['photo', 'photo:album'])) {
|
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));
|
return url(Storage::url($this->firstMedia()->thumbnail_path));
|
||||||
|
|
1
storage/app/public/.gitignore
vendored
1
storage/app/public/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
||||||
*
|
*
|
||||||
!.gitignore
|
!.gitignore
|
||||||
|
!no-preview.png
|
BIN
storage/app/public/no-preview.png
Normal file
BIN
storage/app/public/no-preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in a new issue