当Android中图像文件名称带有空格时,Phonegap getPicture方法失败 [英] Phonegap getPicture method fails when image file names with spaces in Android

查看:98
本文介绍了当Android中图像文件名称带有空格时,Phonegap getPicture方法失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是最新版本的phonegap相机插件(即0.2.9)和3.5版的phonegap Build,在Android上进行了测试,以下是我获取图像的代码:

I'm using the latest version of the phonegap camera plugin (i.e. 0.2.9) and 3.5 of phonegap Build, testing on Android, below is my code for getting images:

navigator.camera.getPicture(uploadPhoto,
       function(message) { console.log('get picture failed');alert(message) },
                         { quality: 50, targetWidth: 400, targetHeight: 400,
                           destinationType: navigator.camera.DestinationType.FILE_URI,
                           sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY }
);

当我选择其文件名不带空格的图像(例如test.jpg)时,会成功调用uploadPhoto方法,但是当我选择其文件名带空格的图像(test 2.jpg)时,警报发生错误消息无法创建位图".

when i choose an image where its filename without spaces (e.g. test.jpg), the uploadPhoto method is called successfully, but when i choose an image where its filename with space (test 2.jpg), error occurs with the alert message "Unable to create bitmap".

推荐答案

我的解决方案是更新到最新版本(5.1.1).

My solution is to update to the latest version (5.1.1).

这篇关于当Android中图像文件名称带有空格时,Phonegap getPicture方法失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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