Created
October 8, 2012 15:50
-
-
Save pulsation/3853211 to your computer and use it in GitHub Desktop.
[Enyo+Cordova] Taking a picture with a phone and send it to a REST service such as a CouchDB database.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.camera.getPicture( | |
function (imageData) { | |
var request = new enyo.Ajax({ | |
url: "http://my_server_address:5984/mobility_camera_test/", | |
method: "POST", | |
handleAs: "json", | |
contentType: "application/json", | |
postBody: '{"image": "' + imageData + '"}' | |
}); | |
request.go({}); | |
}, | |
function (message) { console.log("FIXME: Camera shot failed. " + message); }, | |
{ quality: 50, destinationType: Camera.DestinationType.DATA_URL } | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment