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 EXIF GPS metadata extraction on mobile #360

Merged
merged 19 commits into from
Aug 22, 2022
Merged

Conversation

josephfrazier
Copy link
Owner

@josephfrazier josephfrazier commented Aug 14, 2022

This fixes #361. Here's the whole saga:

Here's an example image that works on desktop, but not mobile: https://photos.app.goo.gl/AcEfSrYTMqgp6JfX8

Using eruda to see the JS console with this branch, I see this on desktop:

Extracted GPS latitude/longitude location from EXIF metadata Object {latitude: 40.717019444444446, longitude: -73.99356388888889}

but this on mobile:

Extracted GPS latitude/longitude location from EXIF metadata Object {latitude: "NaN", longitude: "NaN"}

Seems like this issue might be within the exifr library: https://github.com/MikeKovarik/exifr


To rule out the possibility that the EXIF metadata is getting stripped when uploaded from my phone, I logged out the md5sum of the image right before parsing the metadata, and it is 441018525208457705bf09a8ee3c1093 on both desktop and mobile, yet the GPSLatitude and GPSLongitude arrays are [NaN, NaN, NaN] on mobile, but [40, 43, 1.27]and [73, 59, 36.83] on desktop, respectively.


related exifr issue: MikeKovarik/exifr#64


I logged out the md5sum of the image right before parsing the metadata, and it is 441018525208457705bf09a8ee3c1093 on both desktop and mobile

Ugh, it looks like the package I chose to use might have a bug that causes this value to show up for ArrayBuffers: pvorb/node-md5#49


If I switch to object-hash, I get a sha1 of b287c307cd89cfd2ce779b975b961b4824f2714a on desktop, but it crashes on my phone, so I guess I need something less resource-intensive...


Seems like Android is stripping GPS from EXIF after all, when the <input> element has an accept attribute specifying images, but removing the attribute does the trick for me.

@josephfrazier josephfrazier temporarily deployed to reported-web-mobile-con-fwaxml August 14, 2022 23:14 Inactive
@josephfrazier josephfrazier changed the title WIP Add bottom-right button to open console via eruda, see https://github.com/liriliri/eruda#demo WIP Add bottom-right button to open console Aug 16, 2022
@josephfrazier josephfrazier temporarily deployed to reported-web-mobile-con-fwaxml August 16, 2022 03:47 Inactive
@josephfrazier josephfrazier changed the title WIP Add bottom-right button to open console Fix EXIF GPS metadata extraction on mobile Aug 21, 2022
@josephfrazier
Copy link
Owner Author

related exifr issue: MikeKovarik/exifr#64

@josephfrazier
Copy link
Owner Author

I logged out the md5sum of the image right before parsing the metadata, and it is 441018525208457705bf09a8ee3c1093 on both desktop and mobile

Ugh, it looks like the package I chose to use might have a bug that causes this value to show up for ArrayBuffers: pvorb/node-md5#49

@josephfrazier
Copy link
Owner Author

If I switch to object-hash, I get a sha1 of b287c307cd89cfd2ce779b975b961b4824f2714a on desktop, but it crashes on my phone, so I guess I need something less resource-intensive...

@josephfrazier josephfrazier marked this pull request as ready for review August 22, 2022 00:04
@josephfrazier josephfrazier enabled auto-merge (squash) August 22, 2022 00:08
@josephfrazier
Copy link
Owner Author

It seems like there's still problems with EXIF metadata on an iPad running iOS 16.5, copy/pasting details from slack so I can still find them after slack deletes the messages: https://reportedcab.slack.com/archives/C9VNM3DL4/p1687400617485609

RM
1 day ago
@joseph Frazier
my photo lookup problem appears to be limited to iPad (not iPhone), which is very strange (details in thread)

16 replies

RM
1 day ago
I take photos on a Sony camera (which pulls location from my phone in my pocket, via Bluetooth). Photos are uploaded to the iPad with location data intact.

RM
1 day ago
If I look at a photo on the iPad (in the Photos app), I see the location, but only AFTER I tap the “i” info button. (Here are before and after, note the “Today” at the top of the before, no location showing.)
2 files

Image from iOS

Image from iOS

RM
1 day ago
After I tap, the location “sticks.”

RM
1 day ago
If I look at any of the same photos on the iPhone (synced via iCloud), even at the same time, the location is always visible whether I tap first or not.

RM
1 day ago
If I initiate a report with one of these photos from the iPad (web app, Chrome), the lookup fails (perhaps because the location data is being stripped on upload, but i don’t know where/by what). Lookup failure is instantaneous, as though no location data is present. (edited)

RM
1 day ago
If I initiate a report with THE VERY SAME PHOTO from the iPhone, lookup works normally

RM
1 day ago
The next thing to try: upload a photo from the camera to the iPhone (not the iPad), let it sync via iCloud to the iPad, then try a report from the iPad

RM
1 day ago
Yep, the problem is the iPad

RM
1 day ago
Photo transferred directly from camera to iPhone does location lookup fine from the iPhone; once it syncs via iCloud to the iPad, it doesn’t do it on the iPad. (After syncing, doing a report with the very same photo from the two devices results in different lookup behavior.) (edited)

RM
1 day ago
IPhone is 16.1.1

RM
1 day ago
IPad is 16.5

RM
1 day ago
I wonder if something broke in the later dot release

RM
1 day ago
(If it’s a known iOS issue)

RM
1 day ago
I googled but I'm not very good at it so i couldn’t find evidence that it was

RM
1 day ago
No named fixes/changes in the interim releases appear related to this https://support.apple.com/en-us/HT213407
Apple SupportApple Support
About iOS 16 Updates
iOS 16 brings a redesigned Lock Screen with new ways to customize and widgets for information at a glance. Link your Lock Screen to a Focus and use Focus filters to filter out distracting content in apps. Big updates to Messages let you edit or unsend a message you just sent. Visual Look Up lets you lift the subject of an image from the background and copy and paste it in apps like Mail and Messages. iOS 16 also includes new updates to Mail, Maps, Wallet, Health, News, and more.
For information on the security content of Apple software updates, please visit this website: https://support.apple.com/kb/HT201222

Joseph Frazier
4 minutes ago
thanks for tracking that down,
RM
. If the problem is happening only with the iPad, my best guess is that it must be stripping the EXIF metadata from the image when uploaded, whereas the iPhone must not be. If this is the case, there's nothing I can do about it, unfortunately, unless there's another way I can tweak the element to convince iOS not to strip the metadata, like I did for Android in #360

Joseph Frazier
< 1 minute ago
I googled ios 16.5 exif strip input element and found https://developer.apple.com/forums/thread/678109, where other people are reporting location getting stripped when uploaded into a browser

@josephfrazier
Copy link
Owner Author

iOS seems to have stopped stripping EXIF GPS metadata as of version 17.1.2, see https://reportedcab.slack.com/archives/C9VNM3DL4/p1704407110590749:

Locations are extracting again from photos uploaded to the webapp via iOS

Confirmed to work on iOS 17.1.2 with both photos taken with the phone, and photos taken with an external camera (that included GPS info) and then transferred to the phone (edited)

I thought that iOS had forcibly disabled location sharing on upload

But if so it’s been undisabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EXIF GPS metadata extraction isn't working on mobile as well as desktop
1 participant