如何从文件路径phonegap中检索图像

时间:2015-07-24 05:46:06

标签: android cordova

我使用以下代码从图库中选择图片并获取它的文件路径

  function getPhoto() 
{
  // Retrieve image file location from specified source
    navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 50,
        destinationType: navigator.camera.DestinationType.FILE_URI,
        sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY });
}

     function onPhotoURISuccess(imageURI)
    {
      // console.log(imageURI);

    var largeImage = document.getElementById('myImage');

       largeImage.style.display = 'block';
       largeImage.src = imageURI;

     window.FilePath.resolveNativePath(imageURI, function(result) {
    // onSuccess code
    imageURI = 'file://' + result;
    console.log(imageURI);

现在我想从文件路径中检索图像" imageURI"在不同的视图页面上。怎么做?

注意:得到了解决方案。相同的代码

var largeImage = document.getElementById('demoimg');
            largeImage.style.display = 'block';
            console.log(imageURI);
            largeImage.src = imageURI;

0 个答案:

没有答案