Resizing Image?

Hi,

I’m having an issue resizing photos using the camera-preview-plugin, can any suggest a solution?

I’ve tried using ng2-img-tools but that requires a File and I’m passing the location of the image, which is why it’s probably returning not an jpg / png error.

Any help appreciated.

`import { File } from '@ionic-native/file/ngx';
import { Ng2ImgToolsService } from 'ng2-img-tools';
import { CameraPreview, CameraPreviewPictureOptions } from '@ionic-native/camera-preview/ngx';

constructor(private file: File, public cameraPreview: CameraPreview, private ng2ImgToolsService: Ng2ImgToolsService) { }

    takePhoto()
      {
        this.cameraPreview.takePicture({quality: .7}).then((path) => {

          let tempPath = path[0].substr(0, path[0].lastIndexOf('/') + 1);
          let tempFileName = path[0].replace(tempPath, ""); 
          let fullTempPath = 'file://' + tempPath;

          var newFilename = this.createFileName();
          var permLocation = this.file.dataDirectory + newFilename;

          // Copy Image to Perm Directory....
          this.file.copyFile(fullTempPath, tempFileName, this.file.dataDirectory, newFilename).then(success => {

            var localLocation = window.Ionic.WebView.convertFileSrc(permLocation);

            this.ng2ImgToolsService.resize([localLocation], 640, 640).subscribe(result => {
                //all good, result is a file
                console.info(result);

            }, error => { });

          }, error => { });

        }, error => { });
      }`