我上传一张图片,然后我用
readFile()
读取它,用画布在上面放一些文本,然后将它编码为 base64。但是当我查看它时,我得到的是原始图像,而不是更新后的图像。
这里是把文字放在图片上的方法:
此方法将更新后的图像附加到文档中:
请看看并建议我如何用上传的图像替换我编辑的图像文件。
如果您需要更多信息,我会立即提供。
谢谢
async appendImage(key, item) {
const img = document.createElement('img');
img.classList.add('cache-item');
const file = item.get('image');
const base64 = await new FileReaderAsync(file).readAsDataURL();
img.src = base64;
img.dataset.key = key;
this.imageList.appendChild(img);
$('#cache-image-list-section').show();
}