- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
这可能很简单,PhoneGap 的“相机”插件、"file"插件或“文件传输”插件中的一些功能组合涵盖了这一点。我知道用户可以选择一个文件:
navigator.camera.getPicture(function (fileURI) {
// *** need help here ***
}, function ()
// handle errors
}, {
destinationType: window.Camera.DestinationType.FILE_URI,
sourceType: window.Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: window.Camera.MediaType.ALLMEDIA
});
我也可以更改为 destinationType: window.Camera.DestinationType.DATA_URL
如果有区别的话。
我在成功处理程序中的目标是获取一个文件对象 ( https://developer.mozilla.org/en-US/docs/Web/API/File)。
最佳答案
像这样的东西应该可以做到。
navigator.camera.getPicture(function (fileURI) {
window.resolveLocalFileSystemURL(fileURI,
function(fileEntry){
alert("got image file entry: " + fileEntry.fullPath);
// fileEntry.file() should return a raw HTML File Object
},
function(){//error}
);
}, function (){
// handle errors
}, {
destinationType: window.Camera.DestinationType.FILE_URI,
sourceType: window.Camera.PictureSourceType.PHOTOLIBRARY,
mediaType: window.Camera.MediaType.ALLMEDIA
});
关于javascript - 我如何从 PhoneGap camera.getPicture 获取文件对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22153644/
我有一个运行 cordova 3.1.0 的 phonegap (cordova) 应用程序,当我打电话时 navigator.camera.getPicture(success,fail,optio
我正在使用 Meteor 的 mdg:camera 插件为我的应用程序添加照片功能。目前,我没有任何 PhoneGap 设备设置,所以我正在我的笔记本电脑上进行测试。我以为我在某处读到 Meteor
我的移动应用程序有两个目标。 a) 用手机相机拍照并上传到服务器 b) 从手机相册中选择图片并上传到服务器 我一直在使用 Phonegap,点“a”效果很好。还有“b”。 问题:似乎每秒上传都失败。不
我想在实际打开相机之前确保应用程序具有访问相机的权限,这样如果应用程序没有权限,可以通知用户他们需要在操作系统中更改权限。 这是必要的原因是,当用户不小心拒绝了对相机的许可时,他将不得不导航到操作系统
camera.getPicture 用于在 cordova 中捕获图像。该项目是使用 cordova 3.2.0 开发的。现在我已经将 Cordova 更新到 3.8.0。现在 navigator.c
此代码返回: Cannot read property 'getPicture' of undefined 不知道我做错了什么,你能帮我看看代码吗? 我的应用: angular.module('To
我正在尝试让 Camera API 在我的 PhoneGap android 应用程序中工作,但我一直收到此错误 "Cannot read property 'getPicture' of undef
我有一个简单的 ionic 应用程序,它可以从 Cordova 相机功能中拍摄照片。它无处可去.. 真的需要帮助来解决这个问题..我从几个星期开始就坚持这个......现在.. const cam
我正在尝试通过 phonegap 从 SAVEDPHOTOSALBUM 获取图像并将其显示在屏幕上。就像 phonegap 文档所说,我这样使用 getPicture: navigator.camer
这是一个 ionic 应用程序,在同一个 Controller 中具有 $cordovaImagePicker 和 $cordovaCamera 功能,并且都从同一个 reservation.html
每次我在 iOS 上使用 phonegap API 函数创建图像时,在我点击Use photo 后我都会收到警告。 (内存使用量激增至大约 60MB) 我的代码: navigator.camera.g
我的 PhoneGap 应用程序中有一个简单的链接,它会触发以下方法: navigator.camera.getPicture(function(imageData) {
这可能很简单,PhoneGap 的“相机”插件、"file"插件或“文件传输”插件中的一些功能组合涵盖了这一点。我知道用户可以选择一个文件: navigator.camera.getPicture(f
我编写了一个 Phonegap 应用程序并使用 Build 服务对其进行了编译。 我的应用程序在这段代码中调用相机: 功能捕获照片(){ // Take picture using d
你好 friend 在我的项目中,我可以通过相机或画廊捕捉图像,图像文件的大小根据相机或用户选择的图像的质量而变化到 5-6 MB。然后我必须上传它在服务器上。 要求是,在将文件上传到远程服务器之前,
一切都在标题中,我正在通过 Camera.getPicture 方法访问相机,我可以选择一张照片或拍摄一张照片但是当我访问照片库或相机拍照时,我的错误回调被解雇了,所以我无法取回图片的 URI。它没有
我一直在尝试使用 PhoneGap 功能用我的 Android 手机拍照并将其保存到手机的相册中。我在启动和运行他们的完整示例项目时没有遇到任何问题,但代码永远不会保存图像。我们已经在 Iphone
我正在查看适用于 Android 的 PhoneGap API,并尝试安装在我的 Android 手机 (2.1 Galaxy S) 中的相机示例应用程序示例。但是,在运行该应用程序并拍照后,未检索到
我使用 cordova 相机插件从 ios 中的图库中获取图片,对我来说图片库文件显示速度不快它需要太多时间来加载...我只使用下面的代码。它可以正常工作,但是加载 Photolibrary 需要花费
我正在使用最新版本的 phonegap 相机插件(即 0.2.9)和 3.5 的 phonegap Build,在 Android 上进行测试,下面是我获取图像的代码: navigator.camer
我是一名优秀的程序员,十分优秀!