Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.3k
Fix exif orientation issue when resizing images.#2001
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Rewrite of the existing exif handling code to use built in base64 operations which are much faster.
enyo commentedOct 26, 2021
Woah what a PR! Thanks for that. I'd like to get this in, but how should I be testing this? Can you describe the use cases where it failed before and how you fixed it? I think using the atob and btoa functions is great call now that Dropzone is dropping IE support. |
kaymes commentedOct 26, 2021
It's been a while since I wrote this. As far as I remember the failure case is the following:
Before this PR: the version which arrives on the server is no longer oriented correctly when viewed with an exif-aware image viewer. (It is because the physical orientation has changed but the exif information wasn't updated which leads to the viewer to rotate the image again). The test I would suggest is to take a picture with a mobile phone in portrait mode and configure Dropzone to resize images before the upload. If this all works as expected, then it should be ok. |
alex-levy commentedNov 19, 2021
@enyo any update on this? This is currently blocking our adoption of this library. |
Jaammeesss commentedJan 14, 2022
@enyo is there any updates on this as the issue for phone portrait images being uploaded in the incorrect orientation after upload is still an issue with resizing |
jordanade commentedMay 18, 2022
@enyo any update? |
TheDude70 commentedJun 10, 2022
Will this get merged any time soon? |
DanielStout5 commentedJun 21, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@enyo will this PR get merged? I'm seeing the issue it describes - upload a portrait oriented image with resizeWidth specified and it ends up being incorrect in the processed image. The thumbnail is correct. Including the exif-js library actually made it worse - with that library available, both the thumbnail and the full image end up being incorrect. I put up a npm package with@kaymes's fix merged into the 5.9.3 commit here:https://www.npmjs.com/package/dropzone-exif-fix and it seems to work great. |
dazbradbury commentedNov 16, 2022
Any chance the fix for this will be applied to master, or any of the new releases? |
Pes8 commentedDec 16, 2022
MERGE IT PLEASE 🐊 |
MentalGear commentedJan 14, 2023
Merge for#2081 |
hcw-rohan commentedDec 13, 2023
Currently using this lib in dev for my app but it won't make it to production unless this is fixed. Please merge 😄 |
NicolasCARPi commentedApr 13, 2024
Hello everyone, I have just merged this PR on the maintained fork ( Best, |
NicolasCARPi commentedApr 13, 2024
New release is live with this patch:https://github.com/NicolasCARPi/dropzone/releases/tag/7.1.1 |
redvivi commentedNov 16, 2024
Why is it not merged actually? |
NicolasCARPi commentedNov 16, 2024
Are you using the fork? See my comment above: |
redvivi commentedNov 16, 2024
No, it is available on JSDelivr@NicolasCARPi ? |
NicolasCARPi commentedNov 17, 2024
Yes:https://cdn.jsdelivr.net/npm/@deltablot/dropzone/dist/dropzone-min.js |
This PR fixes the issue with exif orientation when resizing image described in#1967.
With this PR, Exif data is removed from the image before resizing it. This way the browser doesn't fix the orientation and everything is correct when the Exif information is added to the resized image afterwards.
Initially I tried to re-use some of the code of the existing ExifRestorer. However, it proved to be quite slow with to do the base64 encoding/decoding of that class. Thus, I wrote a much simpler and faster version of it which uses the builtin atob() and btoa() functions and subsequently uses strings instead of arrays.
Since this proved effective I also changed the Exif restore code to a simpler and faster function and removed the ExifRestorer.
Unfortunately I haven't worked out how to build the distribution files so I could only do limited testing.