Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions php/class-media.php
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,7 @@ public function image_srcset( $sources, $size_array, $image_src, $image_meta, $a
if ( ! $cloudinary_id ) {
return $sources; // Return WordPress default sources.
}

// Get transformations if any.
$transformations = Relate::get_transformations( $attachment_id );

Expand Down Expand Up @@ -1925,6 +1926,11 @@ function ( $item ) use ( $crop ) {
}
}

// Handle unexpected sources variable type.
if ( ! is_array( $sources ) ) {
return $sources;
}

// Add the main size as the largest srcset src.
$crop = $this->get_crop_from_transformation( $transformations );
if ( ! empty( $crop ) ) {
Expand Down