Closed nacimux closed 7 years ago
Please check app.ts from the runtime example app (repo).
There are the following lines:
image.src = loadEvent.target.result; this.cropper.setImage(image);
This is used for the example when the file input upload is used as external - Is this what you need?
Hi, I have the same question? Can I change the image or color in grey background before loading any image, or between loading images? Or the only way to do this, is loading default file? thx for your help p.s. sorry for my english
I am also trying to set the image and having a problem with that. in my app i have used the cropper to store and save an image, that is working. so i have a variable that has the data to use in an tag and i can display that just fine. in my app i have an ngOnInit() that calls a service to get the image data and in that code i am able to create a local image and the console log seems to show it
console.log("image " , image);
displays:
image <img src="data:image/png;base64,iVB0...."
but setImage(image) does nothing.
what am i missing ?
i am also using angular-cli to build the app.
GAAHH!!! i was missing the needed # template tag in my html!!! now it works just fine!
setDefaultImage(){
let image: HTMLImageElement = new Image();
image.crossOrigin = 'anonymous'; // !!!!!
image.src = this.imgUrl; // src to img
let _this = this;
image.onload = function() {
_this.cropper.setImage(image);
};
}
Hi all,
angular-cli: 1.0.0-beta.17 node: 5.6.0 os: win32 x64
I would like to set a default image to be displyaed in place of the grey backgroud but cant ! I see that the data = {} contain the data image but cant set a default one. thx for your help