From 9b04b9d897a5b1757b51e90ea70f1a187cb9841c Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 30 Mar 2022 23:43:43 -0600 Subject: [PATCH 1/3] Update media model, use original photo url for non-existent thumbnails --- app/Media.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Media.php b/app/Media.php index b90b1c6d2..e6b3ee074 100644 --- a/app/Media.php +++ b/app/Media.php @@ -55,6 +55,10 @@ 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 url(Storage::url($this->media_path)); + } + return url(Storage::url('public/no-preview.png')); } From 41ffc71b283380be8e946350acc611b9c9710f18 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 30 Mar 2022 23:44:15 -0600 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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) From 4701b0e8f075209cec43f06d0b4b684fabfc4326 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Wed, 30 Mar 2022 23:50:32 -0600 Subject: [PATCH 3/3] Update media model, use original photo url for non-existent thumbnails --- app/Media.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Media.php b/app/Media.php index e6b3ee074..1494ab884 100644 --- a/app/Media.php +++ b/app/Media.php @@ -56,7 +56,9 @@ class Media extends Model } if($this->media_path && $this->mime && in_array($this->mime, ['image/jpeg', 'image/png'])) { - return url(Storage::url($this->media_path)); + 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'));