Smaller Images from gallery

I made an app that allows the addition of images form either the camera or gallery. The camera is fine because you use the options to restrict size. But images added form the gallery are not compressed. The app works fine until there are a lot of images added from the gallery (about 20) then the app crashes and wont even communicate with the API in order to store the images.

let alert = this.alertCtrl.create({
      title: 'Add an Image',
      message: 'How would you like to add the image?',
      buttons: [
          text: 'Gallery',
          handler: () => {
            destinationType: Camera.DestinationType.DATA_URL,
            sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
            targetWidth: 1000,
            targetHeight: 1000
            }).then((imageData) => {
              // imageData is a base64 encoded string
              this.base64Image = "data:image/jpeg;base64," + imageData;
              this.isImage = true;
              }, (err) => {

It seems like the target width and height has no effect (Please note that taking a picture from your camera to add applies the restriction of 1000px x 1000px, making the image size around 40KB).

Any suggestions would be appreciated.

same case …target width and target height not produce any effect on image