cstefanache / angular2-img-cropper

Angular 2 Image Cropper
MIT License
364 stars 135 forks source link

Programatically add the image to cropp #18

Closed Mihai-B closed 8 years ago

Mihai-B commented 8 years ago

I do not want to use the button chose file, etc ,etc to select my image that I want to cropp, instead I receive the image from the backend, and I would like to add it programatically to the cropper and diplay it to the user in order for him to cropp.

Is there any possible way of doing this? Any help is much appreciated.

Mihai-B commented 8 years ago

To answer my own question:

let imgObj = new Image();
imgObj.src='data:image/png;base64,' + byteData;
this.cropper.setImage(imgObj);