Skip to content

Instantly share code, notes, and snippets.

@EddyVerbruggen
Created April 13, 2015 06:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EddyVerbruggen/3849700b3072c585d39f to your computer and use it in GitHub Desktop.
Save EddyVerbruggen/3849700b3072c585d39f to your computer and use it in GitHub Desktop.
Tweet a selfie with the Cordova SocialSharing plugin
navigator.camera.getPicture(
function(base64EncodedImg) {
// wrap in a timeout so the native view of SocialSharing doesn't collide with the one from the camera plugin
setTimeout(function() {
window.plugins.socialsharing.shareViaTwitter('Check my latest selfie. I\'m awesome!', 'data:image/jpg;base64,'+base64EncodedImg, null, null, null);
}, 500);
},
function(msg) {
alert("Error: " + msg);
},
{
quality: 50,
targetWidth: 600,
targetHeight: 600,
encodingType: Camera.EncodingType.JPEG,
destinationType: Camera.DestinationType.DATA_URL,
sourceType : Camera.PictureSourceType.CAMERA
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment