Skip to content

Instantly share code, notes, and snippets.

@pulsation
Created October 8, 2012 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pulsation/3853211 to your computer and use it in GitHub Desktop.
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.
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