Sfisioza
Sfisioza

Reputation: 3940

Resize image before upload using ng2-file-upload

How can I resize image before upload when using ng2-file-upload?

In pure JavaScript I'd load image to Canvas, then resize. Does ng2-file-upload have hany events allowing to pre-process uploades files? Any example?

Upvotes: 2

Views: 968

Answers (1)

AVJT82
AVJT82

Reputation: 73387

You have the possibility to use onAfterAddingFile.

fileUploader: FileUploader = new FileUploader({....})

and the onAfterAddingFile will fire when you add a file:

this.fileUploader.onAfterAddingFile = () => {
   console.log(this.fileUploader.queue)
   // do stuff
};

Upvotes: 1

Related Questions