当从具有文件URI的图库中选择时,Cordova相机插件始终返回相同的图像

use*_*793 5 javascript cordova

升级到最新的cordova相机lib 0.3.4后,我可以在从图库中选择图像后获得真实图像uri,返回的文件调用pic.jpg,但是如果我选择另一个,它将返回相同的图像同名pic.jpg,所以我被困在同一个图像:(

图像路径看起来像file:///storage/emulated/0/android/data/app/cache/.pic.jpg

任何的想法?

https://github.com/apache/cordova-plugin-camera/blob/master/src/android/CameraLauncher.java

$scope.getPhoto = function() {
        // Retrieve image file location from specified source
        navigator.camera.getPicture($scope.processImageUri, $scope.onFail, {
            quality: 88,
            correctOrientation: true,
            encodingType: Camera.EncodingType.JPEG,
            destinationType: navigator.camera.DestinationType.FILE_URI,
            sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY,
            allowEdit: true
        });
Run Code Online (Sandbox Code Playgroud)

Esh*_*raj 0

在您的函数之后编写这些代码,并将您的“destinationType:”替换为我的

  function capturePhoto()
	{
      // Take picture using device camera and retrieve image as base64-encoded string
      navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50,
        destinationType: destinationType.DATA_URL });
    }
Run Code Online (Sandbox Code Playgroud)