Phonegap - 从图库中选择图像 [英] Phonegap - Choose Image From Gallery

查看:35
本文介绍了Phonegap - 从图库中选择图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能告诉我,或者指出如何从 Phonegap/Android 中的手机图片库中获取图像的方向?有关于访问相机(效果很好)但不选择现有图像的文档.

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 works great) but not selecting an existing image.

我正在寻找 Phonegap/Javascript 而不是 Java.

I'm looking for Phonegap / Javascript rather than Java.

提前致谢!

推荐答案

呃,Camera 文档涵盖了这一点.这不适合你吗?查看 Camera.PictureSourceType 了解详情.文档站点给出了这个用于导出图像的示例:

Erm, the Camera docs cover this. Is this not working for you? Check out Camera.PictureSourceType for details. The docs site givens this example for deriving an image thus:

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

sourceType 是这里的关键部分.它可以是 Camera.PictureSourceType.CAMERA(默认值),或者对您更有用的是 Camera.PictureSourceType.PHOTOLIBRARYCamera.PictureSourceType.SAVEDPHOTOALBUM.

sourceType is the crucial bit here. It can be Camera.PictureSourceType.CAMERA (the default), or more useful for you it can be Camera.PictureSourceType.PHOTOLIBRARY or Camera.PictureSourceType.SAVEDPHOTOALBUM.

相机文档

这篇关于Phonegap - 从图库中选择图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆