Phonegap - Choose Image From Gallery

后端 未结 6 1017
不思量自难忘°
不思量自难忘° 2020-12-02 23:30

Can anyone tell me, or point me in the direction of how to get an image from the phone\'s image gallery in Phonegap / Android? There\'s docs on accessing the camera (which w

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-03 00:12

    Take a look at this post, it may help you.

    Sometimes, you may face some problem with uploading an existing image. The solution is simple, per this answer. Briefly, you need to convert the native Android URI to one that the API can use:

    // URL you are trying to upload from inside gallery
    window.resolveLocalFileSystemURI(img.URI, function(entry) {
      console.log(entry.fullPath);
      }, function(evt){
        console.log(evt.code);
      }
    );
    

提交回复
热议问题