Skip to content

Conversation

@PatrikKozak
Copy link
Contributor

@PatrikKozak PatrikKozak commented May 1, 2025

This PR updates generateFileData to skip applying resizeOptions after updating an image if resizeOptions.withoutEnlargement is true and the original image size is smaller than the dimensions defined in resizeOptions.

This prevents unintended re-resizing of already resized images when updating or modifying metadata without uploading a new file.

This change ensures that:

  • Resizing is skipped if withoutEnlargement: true

  • Resizing still occurs if withoutEnlargement: false or unset

This resolves an issue where images were being resized again unnecessarily when updating an upload.

Fixes #12280


@dreamy32
Copy link

dreamy32 commented May 2, 2025

please approve. 😆

@dreamy32
Copy link

dreamy32 commented May 5, 2025

@PatrikKozak I tried your PR by modifying the build-generated generateFileData.js, and it works. However, I saw an issue you might've not witness:

While the dimensions do not change anymore, it still tries to compress the image on update.
One of my tests image, passed from 291kb to 271kb. This mean if someone makes multiple change to an image, it will get compressed over and over again.

See video:
https://github.com/user-attachments/assets/9a342f25-cf7d-414b-a105-a0bac813f78d

@PatrikKozak
Copy link
Contributor Author

@dreamy32 Thanks for bringing the above to my attention!

I was able to reproduce the behavior and I'm currently looking into it

@PatrikKozak PatrikKozak merged commit 1235a18 into main May 20, 2025
76 checks passed
@PatrikKozak PatrikKozak deleted the fix/original-file-resize-without-enlargement-update branch May 20, 2025 13:43
@github-actions
Copy link
Contributor

🚀 This is included in version v3.39.0

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

resizeOptions ignore withoutEnlargement/fit for original file on *update*

4 participants