Created
April 13, 2015 06:01
-
-
Save EddyVerbruggen/3849700b3072c585d39f to your computer and use it in GitHub Desktop.
Tweet a selfie with the Cordova SocialSharing plugin
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(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