Phonegap拍照并复制3次

时间:2015-10-22 19:50:08

标签: cordova phonegap-plugins

我可以用Phonegap拍照,但之后,我想用不同的名字保存3次。

是否有复制照片的选项?

1 个答案:

答案 0 :(得分:0)

window.resolveLocalFileSystemURL(<your_file_path>/<file_name>,
     function(fileObj){
         console.log('success! file was found');
         window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onSuccess, null);

         function onSuccess(fileSystem) {
             var documentsPath = fileSystem.root;
             fileObj.copyTo(documentsPath, <your_given_name>,
             function(entry){
                            console.log('copying was successful');
                            console.log('File Path '+entry.fullPath);
             },
             function(){
                            console.log('unsuccessful copying');
             });
         }
     }, 
     function(){
     console.log('failure! file was not found')
});

首先用捕获的图像路径替换<your_file_path>/<file_name>,然后使用for循环迭代此代码并获取多个图像副本。 如需进一步的帮助,请点击此链接FileEntry