forked from github/cordova-android
CB-1014: Out of Memory error when getting image from photo library
This commit is contained in:
parent
1f46240ba9
commit
eb0348d47c
@ -370,7 +370,12 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
|
|||||||
this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId);
|
this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// This is a special case to just return the path as no scaling,
|
||||||
|
// rotating or compression needs to be done
|
||||||
|
if (this.targetHeight == -1 && this.targetWidth == -1 &&
|
||||||
|
this.mQuality == 100 && destType == FILE_URI && !this.correctOrientation) {
|
||||||
|
this.success(new PluginResult(PluginResult.Status.OK, uri.toString()), this.callbackId);
|
||||||
|
} else {
|
||||||
// Get the path to the image. Makes loading so much easier.
|
// Get the path to the image. Makes loading so much easier.
|
||||||
String imagePath = FileUtils.getRealPathFromURI(uri, this.cordova);
|
String imagePath = FileUtils.getRealPathFromURI(uri, this.cordova);
|
||||||
Bitmap bitmap = getScaledBitmap(imagePath);
|
Bitmap bitmap = getScaledBitmap(imagePath);
|
||||||
@ -441,6 +446,7 @@ public class CameraLauncher extends Plugin implements MediaScannerConnectionClie
|
|||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (resultCode == Activity.RESULT_CANCELED) {
|
else if (resultCode == Activity.RESULT_CANCELED) {
|
||||||
this.failPicture("Selection cancelled.");
|
this.failPicture("Selection cancelled.");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user