Skip to content

GH-329: (android) Fixes issue: Exif data lost on many cases#331

Merged
janpio merged 2 commits into
apache:masterfrom
AlvaroHerrero:GH-329
Feb 21, 2019
Merged

GH-329: (android) Fixes issue: Exif data lost on many cases#331
janpio merged 2 commits into
apache:masterfrom
AlvaroHerrero:GH-329

Conversation

@AlvaroHerrero

@AlvaroHerrero AlvaroHerrero commented Aug 26, 2018

Copy link
Copy Markdown
Contributor

Platforms affected

Android

What does this PR do?

Reads the exif data from the file on these cases:
-When destType = DATA_URL
-When file is selected from gallery.
-When targetHeight or targetWidth is set, quality is not 100 or correctOrientation is true

What testing has been done on this change?

Tested on two differente android devices.

Checklist

  • Reported an issue in the JIRA database
  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
  • Added automated test coverage as appropriate for this change.

closes #329

@AlvaroHerrero AlvaroHerrero changed the title GH-329: (android) Fixes issue: Exif data lost on differente cases GH-329: (android) Fixes issue: Exif data lost on many cases Aug 26, 2018
Comment thread src/android/CameraLauncher.java Outdated
// read exifData of source
exifData = new ExifHelper();
exifData.createInFile(filePath);
exif.readExifData();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where is this variable used? If this.correctOrientation is true, it is overwritten again and then used to get the orientation, but otherwise?

@@ -994,6 +994,7 @@ private Bitmap getScaledAndRotatedBitmap(String imageUrl) throws IOException {
// read exifData of source
exifData = new ExifHelper();
exifData.createInFile(filePath);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OT to your PR, but man is this a bad variable file. I read it as "create in file", but it actually means "create in(put)file".

// read exifData of source
exifData = new ExifHelper();
exifData.createInFile(filePath);
exifData.readExifData();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still don't really understand how reading some data into a property/class variable of exifData influences the further execution of code. Can you explain?

@AlvaroHerrero

Copy link
Copy Markdown
Contributor Author

createInFile is the name of the function in the ExifHelper. It initializes all exif properties to null, but it is when readExifData is called when actual exif values are set.
Later, when exifData.writeExifData is called the stored values are set into the new file (rotated or whatever proccess the code does to it).
I think when the createInFile is called, it should be followed by the readExifData one, as it is done inside processResultFromCamera function.

@ddsky

ddsky commented Oct 3, 2018

Copy link
Copy Markdown

I have tested this and it works as intended. Voting for a pull of this fix.

@janpio

janpio commented Oct 3, 2018

Copy link
Copy Markdown
Member

(@ddsky You should be able to leave an actual "Approve" review in the "Files changed" tab - that will make it easier for us to spot the positive review. Thanks!)

@ddsky ddsky left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Worked for me

@j3k0 j3k0 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Works for me and saved my day!

@ddsky

ddsky commented Oct 29, 2018

Copy link
Copy Markdown

any news on when this will be merged?

@janpio

janpio commented Oct 30, 2018

Copy link
Copy Markdown
Member

You will learn about it here by an update to the PR being posted by GitHub. (If I am involved, it will now happen 2 minutes later as I had to open this notification, read your message and reply.)

@BorntraegerMarc

Copy link
Copy Markdown

Can I help in anyway to get this PR merged? It has been quite some time and it seems like everything is ok 🙂

@janpio janpio merged commit 81b878d into apache:master Feb 21, 2019
@BorntraegerMarc

Copy link
Copy Markdown

thanks all for merging! Could someone tell me when the next version release is planned? 🙂

@janpio

janpio commented Feb 21, 2019

Copy link
Copy Markdown
Member

No, as there is not ETA for releases. Someone from the committer team will have to take the time to prepare the release (which means understanding all the PRs merged, giving them another round of testing, doing the actual release. this time probably also updating CI configuration as the last release was some time ago and new OS versions were released - which of course also have to be tested.)

@mirko77

mirko77 commented Mar 7, 2019

Copy link
Copy Markdown

Exif metadata are not saved on iOS either (iOS 12) with the following settings:

camera_options={
  quality: 50,
  sourceType: source_type,
  destinationType: Camera.DestinationType.FILE_URI,
  targetWidth: 1024,
  targetHeight: 1024,
  encodingType: Camera.EncodingType.JPEG,
  correctOrientation: true
};

Is this issue related?

@AlvaroHerrero

Copy link
Copy Markdown
Contributor Author

It should not. I just fixed the Java code for Android.

@mirko77

mirko77 commented Mar 7, 2019

Copy link
Copy Markdown

I will have to open another issue then, could not find any existing one about EXIF data missing on iOS.
Works fine on Android though, and I do not have the PR in my code. Weird

@BorntraegerMarc

Copy link
Copy Markdown

@mirko77 EXIF data is working fine for us on iOS 12

@mirko77

mirko77 commented Mar 7, 2019

Copy link
Copy Markdown

@mirko77 EXIF data is working fine for us on iOS 12

@BorntraegerMarc I cannot figure it out. Even if I take a picture with the camera app and send it to me via Gmail, the image does not have any EXIF metadata in it. Any suggestions?

@chintan13

Copy link
Copy Markdown

I am also facing this issue. let me once you create special issue for it, so I can also follow progress on it.

@mirko77

mirko77 commented Mar 11, 2019

Copy link
Copy Markdown

I am also facing this issue. let me once you create special issue for it, so I can also follow progress on it.

Do you mean you cannot get the EXIF data in iOS as well?

@dlydiard

Copy link
Copy Markdown

i also do not get EXIF data on iOS when using the camera with:
{
quality: 85,
sourceType: Camera.PictureSourceType.CAMERA,
mediaType: Camera.MediaType.PICTURE,
allowEdit: false,
correctOrientation: true
}

@chintan13

Copy link
Copy Markdown

Yes in case of IOS HEIC image format
sourceType = this.camera.PictureSourceType.PHOTOLIBRARY;
destinationType = this.camera.DestinationType.FILE_URI

We are loosing metadata from image.

@mirko77

mirko77 commented Mar 19, 2019

Copy link
Copy Markdown

Has this issue been reported yet? @chintan13 @dlydiard

@chintan13

Copy link
Copy Markdown

no but there is open pr from last two years,
I suspect now that code might be much outdated.

@janpio

janpio commented Jun 19, 2019

Copy link
Copy Markdown
Member

Please open an issue @chintan13 and link to the PR - this will greatly improve the chance that the PR gets merged.

@ryaa

ryaa commented Nov 10, 2019

Copy link
Copy Markdown

Has this issue been reported yet? @chintan13 @dlydiard

I added an issue for the problem with EXIF on iOS (see #524) and provided a potential fix (see #525)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exif data lost when correctOrientation is true

9 participants