Skip to content

Instantly share code, notes, and snippets.

@michaeljymsgutierrez
Created July 26, 2017 14:39
Show Gist options
  • Select an option

  • Save michaeljymsgutierrez/f979800c962d91ea2ea04c5fadf3d9f5 to your computer and use it in GitHub Desktop.

Select an option

Save michaeljymsgutierrez/f979800c962d91ea2ea04c5fadf3d9f5 to your computer and use it in GitHub Desktop.
Simple work around for picking image and converting to b64
/* Initialize options */
var options = {
quality: 50,
destinationType: Camera.DestinationType.DATA_URL,
sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
allowEdit: true,
encodingType: Camera.EncodingType.JPEG,
targetWidth: 800,
targetHeight: 800,
popoverOptions: CameraPopoverOptions,
saveToPhotoAlbum: false
};
/* Fire up camera */
$cordovaCamera.getPicture(options).then(function(imageData) {
$scope.rawImage = "data:image/jpeg;base64," + imageData;
}, function(err) {
/* Encounter error */
console.log(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment