Search code examples
typescriptcordovaionic3cordova-plugin-camera

Ionic cordova iOS ignores targetHeight


I am using the Cordova camera plugin with Ionic on an iPhone (iOS). I try to limit the size of the image stored by adding the targetHeight option. This works on Android by setting the max height to the targetHeight option. On iOS, this is option is ignored and I get an unchanged, large image.

CameraOptions = {
  quality: 50,
  destinationType: this.camera.DestinationType.DATA_URL,
  encodingType: this.camera.EncodingType.JPEG,
  mediaType: this.camera.MediaType.PICTURE,
  targetHeight: 1080,
  correctOrientation: true,
};

Thanks in advance for any help with this.


Solution

  • The problem was that the plugin requires a targetHeight and a targetWidth.