Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: prevent resizing of original file with withoutEnlargement on update #12291

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

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

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*
2 participants