react-native-image-resizer
react-native-image-resizer copied to clipboard
Android: get EXIF orientation from content:// URI on r24+ (#86)
Android has restricted access to the file:// URIs underlying a shared content URI a while ago. I'm not sure when exactly, and my google-fu is weak tonight.
On the other hand, they introduced ExifInterface(InputStream) in r24. This can be used even when we do not have permissions / access to the original file:// URI that the content:// URI resolves to.
So if we are on Android r24+, we use this new API to obtain the EXIF image orientation and to fix portraits being sideways.
I also vote for this to be merged. It fixes really annoying long standing bug. Current createResizedImage()
and other methods relying on getOrientation
should behave consistent and predictable on all android versions.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Is there anything preventing you from merging this? This is a huge UX issue for app users, as camera images end up surprisingly rotated when scaled/cropped.
It looks like a few days ago, all the project code was shuffled around into a new package name / directory structure and indentation scheme, which prevented the old one from applying. I've now updated the PR to work against current master.
Hi @ge0rg ,
We lacked the time to manage this repo (yes, it's been while).
I'm the maintainer now. I see that your topic is still relevant.
I will review you PR this WE 🙏!
Can you just help me and provide me a repro steps to test it properly 😄
I'm sorry, I don't have a minimal repro example, but if you take a portrait picture on any recent Android phone (I thin some time around Android 10), and resize it using rn-ir, it will end up rotated by 90°.