Skip to content
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

fix: handle withoutEnlargement for undefined height or width #10078

Conversation

Zhousiru
Copy link
Contributor

What?

This patch implements the functionality in imageResizer to omit the generation of the image when either width or height is undefined and withoutEnlargement is set to undefined

Why?

#9986: withoutEnlargement doesn't work when height is undefined in upload.imageSizes

How?

This code checks if withoutEnlargement is undefined and either targetWidth or targetHeight is missing. If so, it further checks whether the target dimensions (if provided) are larger than the original image dimensions. If the target would enlarge the image, it returns 'omit', skipping the resizing to prevent enlargement

Fixes #9986

@PatrikKozak
Copy link
Contributor

PatrikKozak commented Jan 6, 2025

Hey @Zhousiru - PR looks good!

I went ahead and added a test in your PR. Once the CI tests all pass, I will merge this

@PatrikKozak PatrikKozak merged commit d212733 into payloadcms:main Jan 6, 2025
68 checks passed
Copy link
Contributor

github-actions bot commented Jan 7, 2025

🚀 This is included in version v3.15.0

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.

withoutEnlargement doesn't work when height is undefined in upload.imageSizes
2 participants