Image Upload from iPhone Strips Exif Data

Image upload from iPhone strips exif data

The problem

It is correct that the iphone(ipad, etc, i'll just call it iphone from now on) strips exif data. This is also not a bug on the iphone but actually a feature.

One of the main reasons android users don't like the iphone and iphone users don't like the androids, is because the iphone is very limited (in terms of freedom to change, alter, etc). You can not just run downloaded apps, have limited access to settings, etc.

This is because the apple strategy is to create a fail-safe product. "If you can not do strange things, strange things will not happen".It tries to protect the user in every way imaginable. It also protects the user when uploading images. In the exif there may be data that can hurt the users privacy. Things like GPS coordinates, but even a timestamp can hurt a user (imagine you uploading a beach picture with a timestamp from a moment you reported in sick with the boss).

So basically it is a safety meassure to strip all exif data. Myself and a lot of other people do not agree with this strategy, but there is nothing we can do about it unfortunately.

The solution

Update: This does not work. (thanks likeitlikeit for this info)

Luckily you can get around this problem. Javascript comes to the rescue. With javascript you can read the exif data and send it with you photo by adding some extra POST data.

please note: this solution was presented to me by another developer and is not yet tested.

Sources

You are asking for credible sources. Unfortunately they are hard to find as apple is not talking as always and therefore all information i have is hearsay.

perhaps one of the more reliable sources i can present is one of the flickr staffmembers who confirms that the root cause is mobile safari stripping the exif.
http://www.flickr.com/help/forum/en-us/72157632100391901/#reply72157632135956813

File Upload and EXIF in mobile Safari

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.

exif when uploading pictures with php on a mobile device stripping GPS header?

Only thing you can do is to create a native app (or Apache Cordova app), that will handle the upload. The GPS data is stripped by mobile Safari. Your app should upload the picture as-is. As of now there is no other way around it.

It may be something along these lines: http://gonzalo123.com/2013/10/28/taking-photos-with-a-phonegapcordova-application-and-uploading-them-to-the-server/

losing GPS metadata while uploading picture with mobile Safari

Mobile Safari strip the GPS data of a picture you upload via a file input box BUT it will keep the other EXIF data. And this will happen what ever your privacy setting is.

How to stop iPhone from re-compressing images during upload to backend?

This issue has been resolved with the iOS update 9.0.3. Apparently, Apple themselves knew of this bug and fixed it.

UIImagePickerController and extracting EXIF data from existing photos

The naughty way to do this is to traverse the UIImagePickerViewController's views and pick out the selected image in the delegate callback.

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

id thumbnailView = [[[[[[[[[[picker.view subviews]
objectAtIndex:0] subviews]
objectAtIndex:0] subviews]
objectAtIndex:0] subviews]
objectAtIndex:0] subviews]
objectAtIndex:0];

NSString *fullSizePath = [[[thumbnailView selectedPhoto] fileGroup] pathForFullSizeImage];
NSString *thumbnailPath = [[[thumbnailView selectedPhoto] fileGroup] pathForThumbnailFile];

NSLog(@"%@ and %@", fullSizePath, thumbnailPath);

}

That will give you the path to the full size image, which you can then open with an EXIF library of your choice.

But, this calls a Private API and these method names will be detected by Apple if you submit this app. So don't do this, OK?

How to strip image metadata in the browser before upload (javascript)

I ran into basically the same problem at work. We didn't find a way to remove the metadata. Instead we solved it by using exif.js to read the metadata, and then drew the image onto a canvas while rotating it appropriately. Vaguely something like this:

var exif = EXIF.findEXIFinJPEG(binary);

switch(exif.Orientation){
case 1: //no change needed
break;
case 2: //horizontal flip
context.translate(imageWidth, 0);
context.scale(-1, 1);
break;

...

case 8: //rotate 90 deg left
context.rotate(-0.5 * Math.PI);
context.translate(-imageWidth, 0);
break;
}

context.drawImage(image, 0, 0, imageWidth, imageHeight);

Hopefully that points you in the right direction.



Related Topics



Leave a reply



Submit