Created
June 9, 2017 15:42
-
-
Save matthieu-D/b9e15a8518765d77a68a69f96b50b5a8 to your computer and use it in GitHub Desktop.
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
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