diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d5d3836c..3db81d6ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -114,6 +114,7 @@ - Updated ApiV1Controller, remove no-preview image from media urls. ([37dfb101](https://github.com/pixelfed/pixelfed/commit/37dfb101)) - Updated DeleteAccountPipeline, fix perf issues. ([a9edd93f](https://github.com/pixelfed/pixelfed/commit/a9edd93f)) - Updated DeleteAccountPipeline, improve coverage. ([4870cc3b](https://github.com/pixelfed/pixelfed/commit/4870cc3b)) +- Updated media model, use original photo url for non-existent thumbnails. ([9b04b9d8](https://github.com/pixelfed/pixelfed/commit/9b04b9d8)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.2 (2022-01-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.1...v0.11.2) diff --git a/app/Media.php b/app/Media.php index b90b1c6d2..1494ab884 100644 --- a/app/Media.php +++ b/app/Media.php @@ -55,6 +55,12 @@ class Media extends Model return url(Storage::url($this->thumbnail_path)); } + 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 : + url(Storage::url($this->media_path)); + } + return url(Storage::url('public/no-preview.png')); }