angular2-img-cropper icon indicating copy to clipboard operation
angular2-img-cropper copied to clipboard

Image cropper with src

Open kenadet opened this issue 7 years ago • 2 comments

Can image cropper have an src attribute , so we can set default image or background?

kenadet avatar May 31 '17 08:05 kenadet

Here is what I use to set the cropperImage default image (maybe this helps you). This example works with an image url (eg. https://test.at/test.jpg).

` @ViewChild('imageCropper', undefined) imageCropper: ImageCropperComponent;

ngAfterViewInit() { let image: HTMLImageElement = new Image(); // lets you use the parent scope (of your Component) let that = this; image.onload = function() { that.imageCropper.setImage(image); }; // fires onload function image.src = imageUrl; // your default imageUrl } `

ClaudioKirchmair avatar Aug 22 '17 14:08 ClaudioKirchmair

Appreciate.

kenadet avatar Aug 22 '17 14:08 kenadet