From 1f46240ba9d26de6602a19364e1cd207a52c3293 Mon Sep 17 00:00:00 2001 From: macdonst Date: Thu, 5 Jul 2012 16:04:47 -0400 Subject: [PATCH] CB-999: When getting images from the PHOTOLIBRARY apply the correctOrientation fix --- framework/src/org/apache/cordova/CameraLauncher.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/framework/src/org/apache/cordova/CameraLauncher.java b/framework/src/org/apache/cordova/CameraLauncher.java index 3251bb3f..fa19ca3d 100755 --- a/framework/src/org/apache/cordova/CameraLauncher.java +++ b/framework/src/org/apache/cordova/CameraLauncher.java @@ -375,12 +375,10 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie String imagePath = FileUtils.getRealPathFromURI(uri, this.cordova); Bitmap bitmap = getScaledBitmap(imagePath); - // If sending base64 image back - if (destType == DATA_URL) { + if (this.correctOrientation) { String[] cols = { MediaStore.Images.Media.ORIENTATION }; Cursor cursor = this.cordova.getActivity().getContentResolver().query(intent.getData(), - cols, - null, null, null); + cols, null, null, null); if (cursor != null) { cursor.moveToPosition(0); rotate = cursor.getInt(0); @@ -391,6 +389,10 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie matrix.setRotate(rotate); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); } + } + + // If sending base64 image back + if (destType == DATA_URL) { this.processPicture(bitmap); }