cordovaCamera and cordovaFile


#1

How is it possible to save images made by cordova-plugin-camera in your own folder?
Later I want to read the folder and list all images.

Here is my code, but it doesn’t work:

 **$scope.takePicture** = function () {
    var options = {
        quality: 80,
        destinationType: Camera.DestinationType.**FILE_URL**,
        sourceType: Camera.PictureSourceType.CAMERA,
        allowEdit: true,
        encodingType: Camera.EncodingType.JPEG,
        targetWidth: 1000,
        targetHeight: 1000,
        cameraDirection: 1,
        popoverOptions: CameraPopoverOptions,
        saveToPhotoAlbum: false
    };
    
    **$cordovaCamera.getPicture**(options).then(function(imageData) {
       // $scope.imgURI = "data:image/jpeg;base64," + imageData;
        
        **$cordovaFile.createDir**(imageDir);
        var directory = imageDir + imageName;

        **$cordovaFile.createFile**(directory, true),

        **$cordovaFile.writeFile**(directory, imageData, {'append':false} ).then( function(result) {
            // Success!
            $scope.result += 'writeFile true, '; // success
        }, function(err) {
            // An error occured. Show a message to the user
            $scope.result += 'writeFile false ' + err; // success
        });
        
        $scope.imgURI = directory;
        
    }, function (err) {
            console.log('Error: ' + JSON.stringify(error));   
    });

I hope you can help me. Thanks a lot!


#2

Did you ever find a solution? Same problem here.