-
-
Notifications
You must be signed in to change notification settings - Fork 644
[6.x] Guard ImageGenerator against a null asset #15447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8c478d0
c94f024
199dbca
7536259
50b5f59
e8024c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| namespace Statamic\Imaging; | ||
|
|
||
| use Facades\Statamic\Imaging\ImageValidator; | ||
| use Illuminate\Support\Facades\Log; | ||
| use Illuminate\Support\Facades\Storage; | ||
| use League\Flysystem\Filesystem; | ||
| use League\Flysystem\UnableToReadFile; | ||
|
|
@@ -150,11 +151,17 @@ public function generateVideoThumbnail($asset, array $params) | |
| /** | ||
| * Generate a manipulated image by an asset. | ||
| * | ||
| * @param \Statamic\Contracts\Assets\Asset $asset | ||
| * @param \Statamic\Contracts\Assets\Asset|null $asset | ||
| * @return mixed | ||
| */ | ||
| public function generateByAsset($asset, array $params) | ||
| { | ||
| if (! $asset) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new
This comment was marked as outdated.
Sorry, something went wrong. |
||
| Log::error('Cannot generate an image for a missing asset.'); | ||
|
|
||
| return ''; | ||
| } | ||
|
|
||
| if ($asset->isVideo() && ThumbnailExtractor::available()) { | ||
| return $this->generateVideoThumbnail($asset, $params); | ||
| } | ||
|
|
||
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as outdated.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.