File Upload and EXIF in mobile Safari
Asked Answered
A

4

13

As noted in these questions, there are cases where foto uploads on iOS have their geolocation and other EXIF metadata removed (in safari):

https://apple.stackexchange.com/questions/326789/gps-exif-from-iphone-photo-upload-in-safari

Image upload from iphone strips exif data

As of now, I have not found a proper description of the circumstances when this happens. I have 2 devices for testing with the latest iOS installed where EXIF metadata is NOT stripped.

Is there a way to determine, most hopefully in the browser or from the upload, if the metadata has been stripped in order to show some kind of info to the user?

Abbotson answered 15/9, 2019 at 7:47 Comment(2)
there are a couple of users that have the same issue through multiple browsers, mobile safari, chrome for ios, etc. we had them try different settings for location sharing, putting the site on the homescreen, allowing the browser to share locations through JS... there is no pattern for when and why it does not work for some users.Abbotson
it's most likely a bug bugs.webkit.org/show_bug.cgi?id=207088Abbotson
B
11

I can tell you right now that with my iPhone X and IOS 13.3 (current) the exif data is stripped if I use the default Settings->Camera->Formats setting, which is 'High Efficiency'. But if I change that to 'Most Compatible', the EXIF data is not stripped. These results are consistent if I do not manipulate the photo at all on my phone before uploading.

It looks like photos that are shot under 'High Efficiency' mode do upload with EXIF data if they have been edited on the phone first - but I have not done extensive testing to verify if this is always the case or under what conditions this always works.

Boydboyden answered 11/1, 2020 at 17:21 Comment(2)
Can confirm, on iOS 13.1.2, for me, the photos shot in "Most Compatible" mode (i.e - originally are JPEGs) retain EXIF unless a resize option is selected instead of sending at "actual size". Has anyone found a workaround at Safari/html/js level to upload the "High Efficiency" ones without stripping EXIF?Kagu
I consider this a bug (missing feature) in iOS sharing settings. A user should be able allow the uploaded file to contain meta-information similar to how it's done when through the share-file dialog between apps. Unfortunately similar things are happening on Android with Chrome and Firefox. Developing Browser Apps that are also usable on mobile devices is becoming impossible these days.Abbotson
P
1

Since iOS 17, users can choose to not strip the exif data.

Sources:

Potherb answered 10/10, 2023 at 12:19 Comment(0)
I
0

Little hard to understand your use case here, but if the idea is to show EXIF has been removed (or not) when a user uploads a file from inside your app, you could inject a script to include this library https://github.com/exif-js/exif-js and then show the result of the EXIF data in a UIAlertView?

Individualist answered 23/9, 2019 at 9:11 Comment(8)
a) exif-js also has no access to the EXIF data, see links above b) how would one create a UIAlertView from within a web-app?Abbotson
the usecase is pretty simple: upload a photo in mobile safari, have the EXIF metadata NOT stripped from it in order to retain the location of where the photo was takenAbbotson
I remember noticing omitted geolocation data in EXIF information for uploaded pictures using mobile safari about 5 years ago, too. I was searching for hours and couldn't solve it because Apple was/is cutting this information without any exceptions in mobile safari. > i have 2 devices for testing with latest iOS installed where EXIF metadata is NOT stripped. Is your website added to Homescreen on those devices? Maybe it makes a difference.Roebuck
At the time when I was looking for a solution I eventually found a statement from Apple confirming the privacy feature. I can not find it anymore but I can also not find anything official stating the opposite. Have you considered enhancing your web app to become a PWA (en.wikipedia.org/wiki/Progressive_web_applications) and access the phone's camera? Maybe those pictures taken directly from within safari contain the geolocation data, or you access the users geolocation when taking the picture and save it with the picture.Roebuck
@Roebuck what would adding the website to the homescreen make a difference?Abbotson
accessing the geo-location ad-hoc would solve the problem, though it is not the primary usecase, which is uploading a bunch of photos that have been taken from the photo app.Abbotson
Its just a wild guess: Maybe Apple believes you trust a website added to homescreen more :D - To be honest I believe apple does not allow uploading geo data in exif information with mobile safari at all so I am wondering how is it possible you have 2 IOS devices that do not strip the exif data when uploading in mobile safari. You REALLY sure they do not?!Roebuck
not only do I have 2 devices running iOS that don't have this problem, there are several other testers who use the app just fine... either way, there is no credible source that points into any direction whatsoever.Abbotson
T
-3

There are now methods to access raw <input type="file"> tag information. This enables you to take your desired EXIF data, put it in a concealed form field, and send it with the real upload of the file.

To get the EXIF:

  1. Create a button that calls a function to generate the file input and add a change handler.
  2. Then, In the file change handler use $(this).get(0).files to get the list of selected files.
  3. Parse the exif data and send the browse results to jsjpegmeta.

This way you can get all the exif Information before its removed.

Trover answered 1/10, 2019 at 6:33 Comment(5)
how is this different from using exif-js? and what exactly is jsjpegmeta, github search comes up with ambigous results.Abbotson
You can use the jsjpegmeta library(Ben Leslie), which is a simple+awesome library that lets the browser extract the EXIF data from most jpeg files.Trover
again, how is it different from the approch of exif-js?Abbotson
once the data is extracted, you already have the EXIF info and hence there are no worries if its stripped later by safari.Trover
i think you are misunderstanding the issue. there is no "later" step. the file that is available through safari does not have the EXIF data, eventhough the local file has them. this behavior is reflected in the questions linked.Abbotson

© 2022 - 2024 — McMap. All rights reserved.