[ 
https://issues.apache.org/jira/browse/CB-8235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14347051#comment-14347051
 ] 

Serge Huijben commented on CB-8235:
-----------------------------------

I have a fix for this, have a look at pull request 65 
https://github.com/apache/cordova-plugin-camera/pull/65

> phonegap plugin getpicture method fails on android when filename has spaces
> ---------------------------------------------------------------------------
>
>                 Key: CB-8235
>                 URL: https://issues.apache.org/jira/browse/CB-8235
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, Plugin Camera
>    Affects Versions: 3.5.0
>         Environment: android
>            Reporter: diwas
>
> My version of the phonegap camera plugin is 0.3.4 and phonegap cli of 
> 4.1.2-0.22.10, android phonegap platform version is 3.6.4, build version 
> 3.5.0 in config.xml, testing on Android 4.x, below is my code snippet for 
> getting images from Samsung phone from either gallery or dropbox:
> navigator.camera.getPicture(
> uploadPhoto,
> function(message)
> {
>   console.log("Get Picture Failed:"+ message);
> }
> ,
> {
>   quality: 50,
>   allowEdit:false,
>   correctOrientation: true,
>   targetWidth: 800,
>   destinationType: navigator.camera.DestinationType.FILE_URI, 
>   sourceType: navigator.camera.PictureSourceType.PHOTOLIBRARY
> }
> );
> when i choose an image from the gallery it always takes the native_uri 
> (content:// )rather than the file_uri (FILE:///), irrespective of the 
> destination type chosen. But when the app tries to access an image via 
> dropbox the returned uri is always file_uri irrespective of the destination 
> type chosen. Now,
>     -If the filename does not have a space in it like 'Photo7.jpg' then it 
> works fine for all cases.
>     -If the file name does have space in it like 'Photo 7 new.jpg' then it 
> works fine if it resides in the gallery since the native_uri is always used 
> and it eliminates the space. Please note that the file_uri still contains 
> space in the filename but is not being used by the getpicture method.
>     -Now the issue comes in when the app tries to access the same image 
> 'Photo 7 new.jpg' via dropbox. In this case the returned uri is always 
> file_uri and contains spaces. This fails the getpicture method of the camera 
> api and executes failure callback with message "Get Picture Failed:Unable to 
> create bitmap!"
> Is there any way to accomodate space by tweaking phonegap/cordova code? Else 
> is there any workaround to encode_uri or anything else? Thanks for any help!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to