Ionic Camera Photo library email attachment issue


#1

Hello guys, i am having an issue with attaching images to the email using email composer. The issue is only on android and with only photo library. When i try to attach image with gmail client, i get error saying “cannot attach image with size zero or unknown”. Below is the code

  const options: CameraOptions = {
    quality: 20,
    destinationType: this.camera.DestinationType.FILE_URI,
    sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
    allowEdit: false,
  }
  this.camera.getPicture(options).then((imageData) => {
    if (this.platform.is('ios'))
      this.images.push(imageData);
    if (this.platform.is('android')) 
      this.images.push(imageData);
  }, (err) => {
    console.log(err.message);
  });

this is the camera code. and below is my package.json

“dependencies”: {
"@angular/common": “5.0.1”,
"@angular/compiler": “5.0.1”,
"@angular/compiler-cli": “5.0.1”,
"@angular/core": “5.0.1”,
"@angular/forms": “5.0.1”,
"@angular/http": “5.0.1”,
"@angular/platform-browser": “5.0.1”,
"@angular/platform-browser-dynamic": “5.0.1”,
"@ionic-native/call-number": “4.4.0”,
"@ionic-native/camera": “^4.4.2”,
"@ionic-native/core": “4.4.0”,
"@ionic-native/email-composer": “^4.3.0”,
"@ionic-native/file": “^4.3.0”,
"@ionic-native/geolocation": “^4.3.0”,
"@ionic-native/in-app-browser": “^4.3.0”,
"@ionic-native/native-geocoder": “^4.3.0”,
"@ionic-native/social-sharing": “^4.3.0”,
"@ionic-native/splash-screen": “4.4.0”,
"@ionic-native/status-bar": “4.4.0”,
"@ionic/storage": “2.1.3”,
“call-number”: “^1.0.1”,
“cordova-android”: “~6.3.0”,
“cordova-ios”: “^4.5.3”,
“cordova-plugin-add-swift-support”: “^1.7.0”,
“cordova-plugin-camera”: “^2.4.1”,
“cordova-plugin-compat”: “^1.2.0”,
“cordova-plugin-device”: “^1.1.7”,
“cordova-plugin-email-composer”: “^0.8.11”,
“cordova-plugin-file”: “^4.3.3”,
“cordova-plugin-geolocation”: “^2.4.3”,
“cordova-plugin-inappbrowser”: “^1.7.2”,
“cordova-plugin-ionic-webview”: “^1.1.16”,
“cordova-plugin-nativegeocoder”: “^2.0.4”,
“cordova-plugin-splashscreen”: “^4.1.0”,
“cordova-plugin-statusbar”: “git+https://github.com/apache/cordova-plugin-statusbar.git”,
“cordova-plugin-whitelist”: “^1.3.3”,
“cordova-plugin-x-socialsharing”: “^5.2.1”,
“es6-promise-plugin”: “^4.1.0”,
“ionic-angular”: “3.9.2”,
“ionic-app-lib”: “^2.2.1”,
“ionic-plugin-keyboard”: “^2.2.1”,
“ionicons”: “3.0.0”,
“mx.ferreyra.callnumber”: “~0.0.2”,
“rxjs”: “5.5.2”,
“sw-toolbox”: “3.6.0”,
“zone.js”: “0.8.18”
},
“devDependencies”: {
"@ionic/app-scripts": “3.1.2”,
“typescript”: “2.4.2”
},
“description”: “An Ionic project”,
“cordova”: {
“plugins”: {
“cordova-plugin-device”: {},
“cordova-plugin-splashscreen”: {},
“cordova-plugin-whitelist”: {},
“ionic-plugin-keyboard”: {},
“cordova-plugin-ionic-webview”: {},
“cordova-plugin-statusbar”: {},
“cordova-plugin-email-composer”: {},
“cordova-plugin-camera”: {
“CAMERA_USAGE_DESCRIPTION”: “Our app needs to access the camera to capture important photos.”,
“PHOTOLIBRARY_USAGE_DESCRIPTION”: “Our app needs to access the camera to capture important photos.”
},
“cordova-plugin-file”: {},
“cordova-plugin-geolocation”: {
“GEOLOCATION_USAGE_DESCRIPTION”: “Our app uses your current location to find nearby services.”
},
“cordova-plugin-inappbrowser”: {},
“cordova-plugin-nativegeocoder”: {
“LOCATION_WHEN_IN_USE_DESCRIPTION”: “Our app uses your current location to find nearby services.”
},
“cordova-plugin-x-socialsharing”: {},
“mx.ferreyra.callnumber”: {}
},
“platforms”: [
“ios”,
“android”
]
}
}

can anyone please help. what i need is to attach an image from gallery(photo library) on android to email with email composer.