[ 
https://issues.apache.org/jira/browse/CB-8235?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

diwas updated CB-8235:
----------------------
    Description: 


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!


  was:
I'm using the latest version of the phonegap camera plugin (i.e. 0.3.4) and 
3.5.0 of phonegap Build, 4.1.2-0.22.10 cli version, testing on Android 4.x, 
below is the 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 }
);

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 function is called back with the alert 
message "Unable to create bitmap!". 


> 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
>    Affects Versions: 3.5.0
>         Environment: android
>            Reporter: diwas
>            Priority: Critical
>
> 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