我认为,这将输出图像的数据
let cameraOptions = {
destinationType: this.camera.DestinationType.DATA_URL
}
但这将输出图像的路径
let cameraOptions = {
destinationType: this.camera.DestinationType.FILE_URL
}
我想输出两者 - 只要我上传图像数据并且还需要路径
如果需要进行一些更改,请在答案中提及此部分
this.camera.getPicture(cameraOptions).then((data) => {
this.imgDate = 'data:image/jpeg;base64,' + data;
});
答案 0 :(得分:1)
您可以在没有网址的情况下显示图片。无需先上传
let cameraOptions = {
destinationType: this.camera.DestinationType.DATA_URL
}
this.camera.getPicture(cameraOptions).then((data) => {
this.imgData = 'data:image/jpeg;base64,' + data;
this.sendToServer(this.imgData);//base64 server sending
});
<img [src]="imgData">