Not allowed to load local resource ionic 3

takePicture(sourceType) {
    try {
        // Create options for the Camera Dialog
        var options = {
          quality:100,
          destinationType:this.camera.DestinationType.FILE_URI,
          encodingType: this.camera.EncodingType.JPEG,
          sourceType : sourceType,
          mediaType :this.camera.MediaType.PICTURE,
          correctOrientation : true,
          saveToPhotoAlbum : true, 
        };
 

   //   this.takephoto(options);
  // Get the data of an image
   this.camera.getPicture(options).then((imagePath) => {
    //Append this to the dom
    
        console.log("Image path is:::" + " " + imagePath);
      //  this.lastImage = `data:image/jpeg;base64,${imagePath}`;
        
    

    // Special handling for Android library
    if (this.platform.is('android') && sourceType === this.camera.PictureSourceType.PHOTOLIBRARY) {
      this.filePath.resolveNativePath(imagePath)
        .then(filePath => {
          let correctPath = filePath.substr(0, filePath.lastIndexOf('/') + 1);
          let currentName = imagePath.substring(imagePath.lastIndexOf('/') + 1, imagePath.lastIndexOf('?'));
          this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
          this.lastImage =filePath;
          console.log(correctPath);
          console.log(filePath);

        });
    } else {
      var currentName = imagePath.substr(imagePath.lastIndexOf('/') + 1);
      var correctPath = imagePath.substr(0, imagePath.lastIndexOf('/') + 1);
      this.copyFileToLocalDir(correctPath, currentName, this.createFileName());
    }
  }, (err) => {
    this.presentToast('Error while selecting image.');
  });


    } catch (e) {
      
      console.error(e);
    }


}


**I also used this filePath by using dom sanitizer but not works....? please let me
**
2 Likes

Any solution for this, even i face the same issue.

1 Like

there is not official solution for this, i do alot of work on my own to load images USING FILE URI
if you removed cordova plugin webview and make changes to whitelist plugin then it will load images using FILE URI…but this time i am unable to load things from assets folder

ohh my god… r you changing the plugin itself?