如何使用Phonegap将Android手机拍摄的图像移动到另一个文件夹

如何使用Phonegap将Android手机拍摄的图像移动到另一个文件夹,android,cordova,Android,Cordova,我正在开发Phonegap 1.5.0,我们的项目需要复制使用Android设备从相机拍摄的照片,并将其移动到另一个文件夹。所有图像都存储在DCIM/100media/camera中。 如何将这些图像移动到其他文件夹?我使用的是HTC Wildfire S 我已经提到了这一点 提前感谢。然后再查看此链接; 在你拍摄完照片后,你会得到照片的路径,你可以使用文件api将它保存到另一个位置。只需读写,然后也可以查看此链接; 在你拍摄完照片后,你会得到照片的路径,你可以使用文件api将它保存到另一个位置

我正在开发Phonegap 1.5.0,我们的项目需要复制使用Android设备从相机拍摄的照片,并将其移动到另一个文件夹。所有图像都存储在DCIM/100media/camera中。 如何将这些图像移动到其他文件夹?我使用的是HTC Wildfire S

我已经提到了这一点

提前感谢。

然后再查看此链接; 在你拍摄完照片后,你会得到照片的路径,你可以使用文件api将它保存到另一个位置。只需读写

,然后也可以查看此链接;
在你拍摄完照片后,你会得到照片的路径,你可以使用文件api将它保存到另一个位置。只要读写

如果在拍照时使用文件URI方法,则可以将结果传递给对象。然后您可以调用FileEntry上的方法

如果在拍照时使用文件URI方法,则可以将该结果传递给对象。然后您可以调用FileEntry上的方法

这是对我有效的解决方案。捕获的图像将被重命名并移动到自定义文件夹(在本例中为SD卡中的TestFolder文件夹)


这是对我有效的解决方案。捕获的图像将被重命名并移动到自定义文件夹(在本例中为SD卡中的TestFolder文件夹)

function capture() {

    // Retrieve image file location from specified source
    navigator.camera.getPicture(getImageURI, function(message) {
        alert('Image Capture Failed');
    }, {
        quality : 40,
        destinationType : Camera.DestinationType.FILE_URI
    });

}

function getImageURI(imageURI) {

    var gotFileEntry = function(fileEntry) {
        alert("got image file entry: " + fileEntry.fullPath);
        var gotFileSystem = function(fileSystem) {

            fileSystem.root.getDirectory("TestFolder", {
                create : true
            }, function(dataDir) {

                // copy the file
                fileEntry.moveTo(dataDir, "1.jpg", null, fsFail);

            }, dirFail);

        };
        // get file system to copy or move image file to
        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFileSystem,
                fsFail);
    };
    // resolve file system for image
    window.resolveLocalFileSystemURI(imageURI, gotFileEntry, fsFail);

    // file system fail
    var fsFail = function(error) {
        alert("failed with error code: " + error.code);

    };

    var dirFail = function(error) {
        alert("Directory error code: " + error.code);

    };
}