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: provide more image metadata in image-picker #29648

Merged
merged 3 commits into from
Jun 11, 2024

Conversation

vonovak
Copy link
Contributor

@vonovak vonovak commented Jun 11, 2024

Why

closes #29442 by adding extra metadata to the result of ImagePicker.launchImageLibraryAsync.

Generally speaking, with these apis, it's easy to miss this or that piece of information because the information is scattered across various places, and there are even manufacturer-specific ones, such as for Minolta, Canon and others.

However, I believe the TIFF information should be commonly present and also brings the result closer to Android.

How

I'm taking metadata from kCGImagePropertyTIFFDictionary and merging it with the existing exif dictionary. In case of duplicate keys, the exif value is preserved.

I removed usage of kCGImagePropertyOrientation because the value, if present, is the same as the value in TIFF metadata source. The key is the same as well, though this is not confirmed by any docs.

Test Plan

Tested on simulator and device

Checklist

No need to update docs, and the rest doesn't apply imo

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jun 11, 2024
@@ -10,7 +10,7 @@
"test:ios": "export NODE_ENV=\"test\" && ./scripts/start-simulator.sh",
"test:android": "export NODE_ENV=\"test\" && ./scripts/start-emulator.sh",
"edit:android": "open -a /Applications/Android\\ Studio.app ./android",
"edit:ios": "open -a Xcode ./ios/BareExpo.xcworkspace",
"edit:ios": "xed ./ios/BareExpo.xcworkspace",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be more robust: because I don't have Xcode.app in applications (I have Xcode15_2 and Xcode15_3), this command failed. xed works for me. https://www.unix.com/man-page/osx/1/xed/

@@ -143,9 +143,7 @@ public class ImagePickerModule: Module, OnMediaPickingResultHandler {
// selection limit = 1 --> single selection, reflects the old picker behavior
configuration.selectionLimit = options.allowsMultipleSelection ? options.selectionLimit : SINGLE_SELECTION
configuration.filter = options.mediaTypes.toPickerFilter()
if #available(iOS 14, *) {
Copy link
Contributor Author

@vonovak vonovak Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the whole fn is wrapped in @available(iOS 14, *) already (line 138)

vonovak and others added 2 commits June 11, 2024 16:53
Co-authored-by: Expo Bot <34669131+expo-bot@users.noreply.github.com>
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jun 11, 2024
@hirbod
Copy link
Contributor

hirbod commented Jun 11, 2024

It would be lovely if the same functionality could be added for the Expo documents picker. They have overlapping functionality, just different picker locations.

@alanjhughes alanjhughes merged commit e7f82b4 into expo:main Jun 11, 2024
18 checks passed
@vonovak vonovak deleted the fix/image-metadata branch August 2, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

expo-image-picker and expo-media-library provide incomplete EXIF information
4 participants