You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "nii amon dsane (JIRA)" <ji...@apache.org> on 2014/03/19 05:36:45 UTC

[jira] [Comment Edited] (CB-6300) window.resolveLocalFileSystemURL weirdness

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

nii amon dsane edited comment on CB-6300 at 3/19/14 4:36 AM:
-------------------------------------------------------------

Hey Ian, some feedback.

1. Adding the org.apache.cordova.file-system-roots plugin fixes the filesystem resolve issue. Yay!

2. When I have the resolved filesystem path and I try to display it on a page, I get a broken link. So somehow, cordova is unable to read the image that's referenced by the resolved filesystem path. This is how I am referencing the image in the page:

{{
<ul>
  <li ng-repeat="image in images">
    <img ng-src='image' />
    {{image}}
  </li>
</ul>
}}

The image path is printed out on the page so I can confirm that it's the correct resolved filesystem path.

3. When I select a picture from the gallery, I get a really weird unresolved URI: file:///storage/sdcard0/Android/data/com.lukaduka.pos/cache/modified.jpg?1395202637809
I suppose the modified.jpg file is a sort of placeholder image and the query string timestamp points to the actual picture in the gallery. That's all fine as long as the filesystem resolve can point me to the right file in the gallery but that doesn't happen. This is the resolved filesystem path I get:

cdvfile://localhost/cache-external/modified.jpg

I suppose that's because the resolve is unable to use the query string part of the URI to resolve to the real file in the gallery.

I have saveToPhotoAlbum: true in the options for the camera and I don't know if setting that to false and then copying the file to a folder is wise. Ideally, I would like all this to be transparent to my code and so should be able to do a camera capture and then when selecting from a folder, I get the true file path not one to the modified.jpg with a querystring. 


was (Author: niiamon):
Hey Ian, some feedback.

1. Adding the org.apache.cordova.file-system-roots plugin fixes the filesystem resolve issue. Yay!

2. When I have the resolved filesystem path and I try to display it on a page, I get a broken link. So somehow, cordova is unable to read the image that's referenced by the resolved filesystem path. This is how I am referencing the image in the page:

<ul>
  <li ng-repeat="image in images">
    <img ng-src='image' />
    {{image}}
  </li>
</ul>

The image path is printed out on the page so I can confirm that it's the correct resolved filesystem path.

3. When I select a picture from the gallery, I get a really weird unresolved URI: file:///storage/sdcard0/Android/data/com.lukaduka.pos/cache/modified.jpg?1395202637809
I suppose the modified.jpg file is a sort of placeholder image and the query string timestamp points to the actual picture in the gallery. That's all fine as long as the filesystem resolve can point me to the right file in the gallery but that doesn't happen. This is the resolved filesystem path I get:

cdvfile://localhost/cache-external/modified.jpg

I suppose that's because the resolve is unable to use the query string part of the URI to resolve to the real file in the gallery.

I have saveToPhotoAlbum: true in the options for the camera and I don't know if setting that to false and then copying the file to a folder is wise. Ideally, I would like all this to be transparent to my code and so should be able to do a camera capture and then when selecting from a folder, I get the true file path not one to the modified.jpg with a querystring. 

> window.resolveLocalFileSystemURL weirdness
> ------------------------------------------
>
>                 Key: CB-6300
>                 URL: https://issues.apache.org/jira/browse/CB-6300
>             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
>     };
>     navigator.camera.getPicture(
>       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 fail.
> Any help here?



--
This message was sent by Atlassian JIRA
(v6.2#6252)