getimage(Type){
let options: CameraOptions;
if (Type == 'camera') {
options = {
quality: 100,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
};
}
else if (Type == 'gallery') {
options = {
sourceType: this.camera.PictureSourceType.SAVEDPHOTOALBUM,
destinationType: this.camera.DestinationType.DATA_URL,
encodingType: this.camera.EncodingType.JPEG,
mediaType: this.camera.MediaType.PICTURE
};
}
this.camera.getPicture(options).then((img) => {
let base64Image = 'data:image/jpeg;base64,' + img;
this.test(base64Image )
})
test(input:string)
{
let alert = this.alertCtrl.create({
title: input,
subTitle: input,
buttons: ['OK']
});
alert.present();
base64Image没有输出base64image 我比较了输出结果和转换相同图像enligne的结果,而我的代码的输出结果与不同图像始终相同