2012-03-27 8 views

答えて

2

画像を撮影するときにFILE_URIアプローチを使用している場合は、その結果をwindow.resolveLocalFileSystemURIに渡してFileEntryオブジェクトを取得することができます。その後、FileEntryのcopyToメソッドを呼び出すことができます。

4

私のために働く解決策はここにあります。撮影した画像は、名前を変更し、

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); 

    }; 
} 
あなたのコードが助けた
+1

おかげでたくさんme.Many多くのおかげで(SDカードにTestFolderフォルダに、このケースでは)カスタムフォルダに移動さ​​れます – surhidamatya