Return-Path: X-Original-To: apmail-cordova-issues-archive@minotaur.apache.org Delivered-To: apmail-cordova-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BEC6C10039 for ; Wed, 19 Mar 2014 18:45:55 +0000 (UTC) Received: (qmail 38711 invoked by uid 500); 19 Mar 2014 18:45:55 -0000 Delivered-To: apmail-cordova-issues-archive@cordova.apache.org Received: (qmail 38626 invoked by uid 500); 19 Mar 2014 18:45:55 -0000 Mailing-List: contact issues-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list issues@cordova.apache.org Received: (qmail 37706 invoked by uid 99); 19 Mar 2014 18:45:46 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Mar 2014 18:45:46 +0000 Date: Wed, 19 Mar 2014 18:45:46 +0000 (UTC) From: "nii amon dsane (JIRA)" To: issues@cordova.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (CB-6300) window.resolveLocalFileSystemURL weirdness MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CB-6300?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13940817#comment-13940817 ] nii amon dsane commented on CB-6300: ------------------------------------ Hey [~iclelland]. I've got some interesting behaviour to report. 1. Using toNativeURL() actually works fine when i'm using the camera to grab an image. When the resolve success function runs and I call toNativeURL() on the fileEntry, I get a file URL like this: file:///storage/sdcard0/DCIM/Camera/1395247431562.jpg This is the original file URL that the navigator.camera.getPicture hands back anyway. 2. I can render this in the view and it works correctly. Interesting to note that I was previously trying to render this same URL type and it was not working. I suppose this has something to do with the org.apache.cordova.file-system-roots plugin you asked me to add to the project. 3. When I select a picture from the gallery, I get the file URL with the cache busting query string: file:///storage/sdcard0/Android/data/com.lukaduka.pos/cache/modified.jpg?1395202637809 Passing that through the resolve predictably gives me the absolute path of the modified.jpg file: file:///storage/sdcard0/Android/data/com.lukaduka.pos/cache/modified.jpg Not very useful since I want to get the absolute file of the image so that I can refer to it later without having to go through the same process again. So the toNativeURL() approach works but only halfway. > 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)