File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
packages/api/src/Domain/Media Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ class MediaDefinitions extends StandardMediaDefinitions implements MediaDefiniti
1919 */
2020 public static function applyConversions (HasMedia $ model ): void
2121 {
22- foreach (self ::conversions () as $ options ) {
22+ foreach (static ::conversions () as $ options ) {
2323 /** @var ConversionOptions $options */
2424 $ model ->addMediaConversion ($ options ->key )
2525 ->when (
@@ -78,7 +78,7 @@ public static function conversions(): array
7878 protected function registerCollectionConversions (MediaCollection $ collection , HasMedia $ model ): void
7979 {
8080 $ collection ->registerMediaConversions (function (Media $ media ) use ($ model ) {
81- self ::applyConversions ($ model );
81+ static ::applyConversions ($ model );
8282 });
8383 }
8484}
Original file line number Diff line number Diff line change @@ -47,8 +47,14 @@ public function fields(): array
4747 ),
4848
4949 Str::make ('srcset ' )->extractUsing (
50- static fn (Media $ model ) => $ model ->getSrcSet ('webp ' ) ?? $ model ->getSrcSet ()
51- ),
50+ static function (Media $ model ) {
51+ if ($ model ->hasGeneratedConversion ('webp ' )) {
52+ return $ model ->getSrcSet ('webp ' );
53+
54+ }
55+
56+ return $ model ->getSrcSet ();
57+ }),
5258
5359 ArrayHash::make ('custom_properties ' ),
5460
You can’t perform that action at this time.
0 commit comments