Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Created June 9, 2017 15:42
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 matthieu-D/b9e15a8518765d77a68a69f96b50b5a8 to your computer and use it in GitHub Desktop.
Save matthieu-D/b9e15a8518765d77a68a69f96b50b5a8 to your computer and use it in GitHub Desktop.
selectAvatar() {
const options: CameraOptions = {
quality: 100,
targetHeight: 200,
targetWidth: 200,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
}
this.camera.getPicture(options).then((imageData) => {
let loading = this.loadingCtrl.create({
content: 'Please wait...'
});
loading.present();
// imageData is either a base64 encoded string or a file URI
// If it's base64:
this.selectedPhoto = this.dataURItoBlob('data:image/jpeg;base64,' + imageData);
this.upload(loading);
}, (err) => {
// Handle error
});
//this.avatarInput.nativeElement.click();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment