Skip to content

Conversation

kevinmeijer97
Copy link
Member

When adding presets it's possible to keep the width on null, for example:
'smallProduct' => ['h' => 406, 'w' => null, 'fm' => 'webp', 'fit' => 'crop_focal'],

Before adding this check this could result in the following srcset being created:
Screenshot 2025-04-15 at 08 38 33
This would add sources with an empty width.

This PR fixes that problem.

@royduin royduin merged commit 431fef7 into master Apr 15, 2025
12 checks passed
@royduin royduin deleted the feature/fix-empty-w-presets branch April 15, 2025 07:29
$index = 0;

foreach ($configPresets as $preset => $data) {
if(!($data['w'] ?? false)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If w is null you shouldn't have to do the ?? false. Also; shouldn't we also have the width config? Maybe in the future add a validator that validates the config?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants