首页 文章

如何在Ionic 3中显示捕获的图像预览?

提问于
浏览
3

我正在开发离子3应用程序,我想用相机捕获多个(3)图像,在相机图标下方显示图像的预览并上传图像以及剩余信息 .

I am not able to display the preview of captured images.

let options: CaptureImageOptions = { limit: 3 };
this.mediaCapture.captureImage(options)
  .then(data: MediaFile[]) => {
      this.images = data;
    },
    (err: CaptureError) => console.error(err)
  );

HTML代码 -

<div *ngFor="let image of images">
        <img src="{{image.fullPath}}" />
      </div>

我在数据中得到以下图像数组:MediaFile []变量
enter image description here

当我将图像的完整路径绑定到img src时,它在我打印完整路径时没有显示任何内容,它给出了以下图像路径 .

file:///storage/emulated/0/Pictures/1534070545509.jpg

请让我解决这个问题 .

1 回答

  • 0

    试试这个,

    <div *ngFor="let image of images">
            <img src="'data:image/jpeg;base64,' +{{image.fullPath}}" />
    </div>
    

相关问题