mirror of
https://github.com/apache/cordova-plugin-camera.git
synced 2025-01-19 03:42:52 +08:00
parent
1650dce693
commit
543c4198d8
13
src/android/CameraLauncher.java
Executable file → Normal file
13
src/android/CameraLauncher.java
Executable file → Normal file
@ -380,14 +380,19 @@ public class CameraLauncher extends CordovaPlugin implements MediaScannerConnect
|
|||||||
else if (destType == FILE_URI || destType == NATIVE_URI) {
|
else if (destType == FILE_URI || destType == NATIVE_URI) {
|
||||||
if (this.saveToPhotoAlbum) {
|
if (this.saveToPhotoAlbum) {
|
||||||
Uri inputUri = getUriFromMediaStore();
|
Uri inputUri = getUriFromMediaStore();
|
||||||
//Just because we have a media URI doesn't mean we have a real file, we need to make it
|
try {
|
||||||
uri = Uri.fromFile(new File(FileHelper.getRealPath(inputUri, this.cordova)));
|
//Just because we have a media URI doesn't mean we have a real file, we need to make it
|
||||||
|
uri = Uri.fromFile(new File(FileHelper.getRealPath(inputUri, this.cordova)));
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
uri = null;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
uri = Uri.fromFile(new File(getTempDirectoryPath(), System.currentTimeMillis() + ".jpg"));
|
uri = Uri.fromFile(new File(getTempDirectoryPath(), System.currentTimeMillis() + ".jpg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri == null) {
|
if (uri == null) {
|
||||||
this.failPicture("Error capturing image - no media storage found.");
|
this.failPicture("Error capturing image - no media storage found.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all this is true we shouldn't compress the image.
|
// If all this is true we shouldn't compress the image.
|
||||||
@ -735,11 +740,11 @@ private String ouputModifiedBitmap(Bitmap bitmap, Uri uri) throws IOException {
|
|||||||
Uri uri;
|
Uri uri;
|
||||||
try {
|
try {
|
||||||
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
||||||
} catch (UnsupportedOperationException e) {
|
} catch (RuntimeException e) {
|
||||||
LOG.d(LOG_TAG, "Can't write to external media storage.");
|
LOG.d(LOG_TAG, "Can't write to external media storage.");
|
||||||
try {
|
try {
|
||||||
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);
|
uri = this.cordova.getActivity().getContentResolver().insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);
|
||||||
} catch (UnsupportedOperationException ex) {
|
} catch (RuntimeException ex) {
|
||||||
LOG.d(LOG_TAG, "Can't write to internal media storage.");
|
LOG.d(LOG_TAG, "Can't write to internal media storage.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user