简体   繁体   English

我想在 ionic 3 中打开相机后拍摄多张图像

[英]I want to capture multiple images once open camera in ionic 3

I want to capture multiple images at once using the camera.我想使用相机一次拍摄多张图像。 I am able capture only one image when the user clicks.当用户单击时,我只能捕获一张图像。 But on clicking the success button, I want to capture multiple images ( 4 images ).但是在单击成功按钮时,我想捕获多张图像(4 张图像)。

 let options: CaptureImageOptions = { 
   limit: 3 
  };     

 this.mediaCapture.captureImage(options).then((data: MediaFile[]) => {
    let file = data.pop();
    let path = file.fullPath.replace('file://','');
    this.photos.push(path)
 } 

I am using this plugin, camera is working but I am unable to display the image.我正在使用这个插件,相机正在工作,但我无法显示图像。

assuming that your code works perfectly if you want to display the image如果你想显示图像,假设你的代码完美运行

let options: CaptureImageOptions = { 
   limit: 3 
  };     

 this.mediaCapture.captureImage(options).then((data: MediaFile[]) => {
    let file = data.pop();
    let path = file.fullPath.replace('file://','');
    this.photos.push(path)
 } 

To display the image do this要显示图像,请执行此操作

<ion-card *ngFor="let photo of photos>
          <div>
            <img [src]="photo" *ngIf="photo/>
          </div>
 </ion-card>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM