目前,我设法更改了图像宽度,但无法更改为我提供更改后的图像的base64值。下面是我的代码 this.fileTobeUpload = file.item(0);
var reader = new FileReader();
reader.onloadend = (event: any) => {
var image = new Image();
image.src = event.target.result;
image.onload = () => {
image.width = 200;
}
this.previewImage = event.target.result;
this.newsItem.image = this.previewImage
}
reader.readAsDataURL(this.fileTobeUpload);