【发布时间】:2019-02-07 23:59:01
【问题描述】:
当使用相机以destinationType: this.camera.DestinationType.FILE_URI 拍照时,生成的 URL 将无法显示图像。例如,当尝试拍摄这样的照片时:
this.camera.getPicture(options).then((url) => {
// Load Image
this.imagePath = url;
}, (err) => {
console.log(err);
});
尝试将其显示为<img [src]="imagePath" > 将导致错误(找不到文件)。
这里的问题是 URL 位于 file:///storage... 路径中,而不是基于 localhost 的正确路径。
【问题讨论】: