mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
CB-999: When getting images from the PHOTOLIBRARY apply the correctOrientation fix
This commit is contained in:
parent
14870726e0
commit
1f46240ba9
@ -375,12 +375,10 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
|
|||||||
String imagePath = FileUtils.getRealPathFromURI(uri, this.cordova);
|
String imagePath = FileUtils.getRealPathFromURI(uri, this.cordova);
|
||||||
Bitmap bitmap = getScaledBitmap(imagePath);
|
Bitmap bitmap = getScaledBitmap(imagePath);
|
||||||
|
|
||||||
// If sending base64 image back
|
if (this.correctOrientation) {
|
||||||
if (destType == DATA_URL) {
|
|
||||||
String[] cols = { MediaStore.Images.Media.ORIENTATION };
|
String[] cols = { MediaStore.Images.Media.ORIENTATION };
|
||||||
Cursor cursor = this.cordova.getActivity().getContentResolver().query(intent.getData(),
|
Cursor cursor = this.cordova.getActivity().getContentResolver().query(intent.getData(),
|
||||||
cols,
|
cols, null, null, null);
|
||||||
null, null, null);
|
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
cursor.moveToPosition(0);
|
cursor.moveToPosition(0);
|
||||||
rotate = cursor.getInt(0);
|
rotate = cursor.getInt(0);
|
||||||
@ -391,6 +389,10 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
|
|||||||
matrix.setRotate(rotate);
|
matrix.setRotate(rotate);
|
||||||
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
|
bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If sending base64 image back
|
||||||
|
if (destType == DATA_URL) {
|
||||||
this.processPicture(bitmap);
|
this.processPicture(bitmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user