add fallback for nbo conversion

This commit is contained in:
Philipp Lang 2023-03-14 11:35:24 +01:00
parent 8a4dc77cfa
commit fb7f70fb12
1 changed files with 4 additions and 3 deletions

View File

@ -39,9 +39,10 @@ class MediaData extends Data
public static function fromMedia(Media $media): self
{
$conversions = collect($media->getMediaConversionNames())->flip()->map(fn ($integer, $conversion) => [
'original_url' => $media->getFullUrl($conversion),
]);
$conversions = collect($media->getMediaConversionNames())->flip()->map(fn ($integer, $conversion) => $media->hasGeneratedConversion($conversion)
? ['original_url' => $media->getFullUrl($conversion)]
: null,
);
return self::withoutMagicalCreationFrom([
...$media->toArray(),