在phonegap中更改或编辑图像文件名

时间:2014-12-15 10:45:06

标签: cordova camera phonegap-plugins cordova-plugins

是否可以更改或提供自定义图像文件名而不是相机API cordova中的默认图像名称? [对于IOS和android]版本Cordova 3.5.0

1 个答案:

答案 0 :(得分:0)

var captureSuccess = function (mediaFiles) {
   // SystemURI require string and path2 will deal it and must not use file:/(path)
   var path = mediaFiles[0].fullPath;
   var path2 = path.slice(0, 5) + "//" + path.slice(5);
   window.resolveLocalFileSystemURI(path2, successMoveTo, fail);
}

function successMoveTo(entry) {
    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0,
        function (fileSys) {
           fileSys.root.getDirectory(folder, {create: true, exclusive: false},
            function (directory) {
                entry.moveTo(directory, file,
                    success, fail);
        }, fail);
    }, fail);
}