How to implement the ng2-img-max of the Angular?

0

My problem is as follows;

I'm able to save and display the images using my API, but at the moment of displaying the images on screen it gets blown, ie my images are 4800 x 3255 resolution, it's a very high resolution, I could resize one by one by PhotoShop, but a coworker indicated this technology to me just below;

ng2-img-max

What she does is before she resizes the image. I have already installed and configured the project to receive the ng2-img-max

This is exactly the code that needs to be completed;

Before this,

 public filesToUpload: Array<File>;
    fileChangeEvent(fileInput: any) {
      this.filesToUpload = <Array<File>>fileInput.target.files;
    }

And I modified it to stay like this;

uploadedImage: File;

  public filesToUpload: Array<File>;
    fileChangeEvent(fileInput: any) {
      this.filesToUpload = <Array<File>>fileInput.target.files;

      this.ng2ImgMax.resizeImage(this.filesToUpload, 400, 300 ).subscribe (
            result => {
              this.uploadedImage = result;
            },
            error => {
              console.log(<any>error);
            }
          );

    }

But you are generating this error;

Andseewheretheerroris;

The error is on line 88, although I know where the error is, I do not know how to correct the error, I need help.

One of my attempts, but I was not successful;

uploadedImage: File;


    public filesToUpload: any;
      fileChangeEvent(event) {

        let filesToUpload = event.target.files[0];

        this.ng2ImgMax.resizeImage(filesToUpload, 400, 300 ).subscribe (
              result => {
                this.uploadedImage = new File([result], result.name);
              },
              error => {
                console.log(<any>error);
              }
            );

      }
    
asked by anonymous 06.06.2018 / 18:12

0 answers