mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-02-22 22:12:54 +08:00
fix(android): Fixed exif handling when loading picture from gallery
This commit is contained in:
parent
9eecbaa1af
commit
6cd2b1db61
@ -778,7 +778,22 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
||||
|
||||
// If sending base64 image back
|
||||
if (destType == DATA_URL) {
|
||||
this.processPicture(bitmap, this.encodingType);
|
||||
// To allow keeping the Exif data, we need to save the image to allow ExifInterface add the data
|
||||
// After that, we load the image and send it as base64
|
||||
try {
|
||||
String modifiedPath = this.outputModifiedBitmap(bitmap, uri, mimeTypeOfGalleryFile);
|
||||
InputStream fileStream = FileHelper.getInputStreamFromUriString(modifiedPath, cordova);
|
||||
byte[] file = new byte[fileStream.available()];
|
||||
|
||||
fileStream.read(file);
|
||||
|
||||
byte[] output = Base64.encode(file, Base64.NO_WRAP);
|
||||
String js_out = new String(output);
|
||||
this.callbackContext.success(js_out);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
this.failPicture("Error retrieving image: "+e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// If sending filename back
|
||||
|
Loading…
Reference in New Issue
Block a user