Phonegap 拍照并复制 3 次
Phonegap take a photo and copy it 3 times
我可以用 Phonegap 拍照,但之后,我想用不同的名称保存 3 次。
是否有复制照片的选项?
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 循环迭代此代码并获取图像的多个副本。
如需进一步帮助,请阅读此 link FileEntry
我可以用 Phonegap 拍照,但之后,我想用不同的名称保存 3 次。
是否有复制照片的选项?
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 循环迭代此代码并获取图像的多个副本。
如需进一步帮助,请阅读此 link FileEntry