Note that there are some explanatory texts on larger screens.

plurals
  1. POLoad contents of image from camera to a file
    text
    copied!<p>I am taking a picture (or selecting from library) using phonegap API using the following drictive: </p> <pre><code>MyApp.directive('Camera', function () { return { restrict: 'A', require: 'ngModel', link: function(scope, elm, attrs, ctrl) { elm.bind('click', function() { navigator.camera.getPicture(function (imageURI) { scope.$apply(function() { ctrl.$setViewValue(imageURI); }); }, function (err) { ctrl.$setValidity('error', false); }, //Options =&gt; http://docs.phonegap.com/en/2.6.0/cordova_camera_camera.md.html#Camera { quality: 50, destinationType:Camera.DestinationType.FILE_URI }) }); } }; }); </code></pre> <p>Which return me a URI that looks like, using ripple emulator on chrome, which I cann see pasting this URI.</p> <pre><code>blob:http%3A//localhost%3A8080/8e18de30-d049-4ce2-ae88-8500b444581e </code></pre> <p>My issue is loading this URI</p> <pre><code>$scope.updateUserProfile = function (user) { var myPicfile = $http.get(user.myPicture); dataService.uploadPicture . . . some code to update the picture to Parse } </code></pre> <p>*Note: <a href="https://parse.com/questions/file-upload-returns-201-but-doesnt-seem-to-be-valid" rel="noreferrer">I cannot use phonegap filetransfer together with parse.com :</a> </p> <p>When I do that I get: </p> <p><img src="https://i.stack.imgur.com/OcuvA.png" alt="enter image description here"></p> <p>I am making my request like:</p> <p>uploadPicture: function uploadPicture(user,callback) { var serverUrl = '<a href="https://api.parse.com/1/files/" rel="noreferrer">https://api.parse.com/1/files/</a>' + user.Nick ;</p> <pre><code> $http({ method: 'POST', url: serverUrl, data: user.myPicture, headers: {'X-Parse-Application-Id': PARSE_APP_ID, 'X-Parse-REST-API-Key': PARSE_REST_API_KEY, 'Content-Type': 'text/plain' } }) </code></pre> <p>Any idea on how to get the content of the image to a file that then I can happily upload to Parse.com?</p> <p>Thanks!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload