# Infinite picture taking until cancel is pressed?

**URL:** <https://forum.ionicframework.com/t/infinite-picture-taking-until-cancel-is-pressed/129317>\
**Category:** ionic-v3\
**Created:** [April 30, 2018, 11:04am UTC](https://forum.ionicframework.com/t/infinite-picture-taking-until-cancel-is-pressed/129317 "2018-04-30T11:04:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![3plconnor](https://avatars.discourse-cdn.com/v4/letter/3/ba9def/32.png) [@3plconnor](https://forum.ionicframework.com/u/3plconnor)\
**Post date:** [April 30, 2018, 11:04am UTC](https://forum.ionicframework.com/t/infinite-picture-taking-until-cancel-is-pressed/129317/1 "2018-04-30T11:04:30Z")

</div>

Hi,

I’m working on an app at the moment that required at least 4 pictures are taking. I’m trying to restart the camera every time a picture is taken so they don’t have to click the take picture button again on the app menu. Here is my code so far:

```auto
  startCamera() {
    if(this.pictureList.length >= 4) {
      this.alertController.create({
        title: this.singleton.TITLE_ERROR,
        message: this.singleton.MESSAGE_TOOMANYPHOTOS,
        buttons: [
          {
            text: 'Ok',
          }
        ]
      }).present();
      return;
    }

    let imageData = "";
    this.camera.getPicture(this.options).then((imageData) => {
      this.pictureList.push(imageData);

      let temp = [];
      for (let i of this.pictureList) i && temp.push(i);

      this.pictureList = temp;
      this.slides.refresh();
    }, (err) => {
      console.log(err);
    });
  }

```

However, the camera does not restart back into the camera? Is there any reason why this wouldn’t work? I’m thinking it’s do to with a me trying to call a function inside of a promise?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:37pm UTC](https://forum.ionicframework.com/t/infinite-picture-taking-until-cancel-is-pressed/129317/2 "2021-07-19T21:37:31Z")

</div>


