cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Clelland (JIRA)" <>
Subject [jira] [Commented] (CB-6300) window.resolveLocalFileSystemURL weirdness
Date Wed, 19 Mar 2014 13:46:43 GMT


Ian Clelland commented on CB-6300:

Thanks, posting the actual URL was quite helpful, actually, for tracking this down.

The Cordova camera plugin is modifying the raw image that the camera provides, because of
the options you've specified (targetWidth, targetHeight, and, most recently, correctOrientation
will all trigger this).

The camera plugin is resizing and orienting your image, and saving it into the temp directory,
with the name "modified.jpg". The extra "?1395202637809" is added at the end to trick the
browser into reloading the image from disk, and not using a cached previously-taken picture.

The problem here seems to be that the camera plugin is saving to a different temporary directory
than the file plugin is using. That's why you needed the file-system-roots plugin, and why
the file was resolved as being on "cache-external", rather than "temporary".

> window.resolveLocalFileSystemURL weirdness
> ------------------------------------------
>                 Key: CB-6300
>                 URL:
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CordovaJS, Plugin File
>    Affects Versions: 3.3.0
>         Environment: file plugin 1.0.1
>            Reporter: nii amon dsane
>            Assignee: Ian Clelland
>              Labels: camera, file, newbie, plugin, resolveLocalFileSystemURL
> I am trying to use the window.resolveLocalFileSystemURL but for some reason my failure
callback is always triggered. The success callback is never triggered. This is my code:
> {code}
> // Take a picture using the camera
> $scope.takePicture = function () {
>     var options = {
>       quality: 100,
>       targetWidth: 500,
>       targetHeight: 500,
>       destinationType: Camera.DestinationType.FILE_URI,
>       encodingType: Camera.EncodingType.JPEG,
>       saveToPhotoAlbum: true,
>       correctOrientation: true,
>       sourceType: Camera.PictureSourceType.CAMERA,
>       allowEdit: true
>     };
>       cameraSuccess,
>       cameraFailure,
>       options
>     );
>     return false;
>   };
>   // what to do when the camera has  successfully yielded a good image
>   function cameraSuccess(imageURI){
>     var uri = 'cdv' + imageURI;
>     alert('this is imageURI: ' + imageURI);
>     window.resolveLocalFileSystemURL(imageURI, resolvePhotoPath, fail);
>   };
> {code}
>   When I print out the imageURI, I get something like this:
>   file:///storage/sdcard0/DCIM/Camera/1395126124474.jpg
>   I can confirm that when I look at that path using the Files application on an   android,
the file is indeed there. But when the code runs and it executes the window.resolveLocalFileSystemURL,
the fail callback is always triggered with an error of \{"code":5}.
> I've seen that that means there's an ENCODING_ERR but a bit baffled as to what is causing
that. The file does save properly to that location so I am at a loss at to why the code will
> Any help here?

This message was sent by Atlassian JIRA

View raw message