我正在为我的文档使用 keditor。我的问题是图像生成为 blob,我无法知道它们存储在哪里,因此当将文件转换为另一种格式时图像会丢失。
带有 blob 的示例图像标签:
<img src="blob:http://localhost/7b0e82ab-445b-4866-b8b5-09b4881a0544" width="100%" height="" style="display: inline-block;">
我希望能找到一种使用 PHP 或 JS 将其转换为 blob 的方法。
我也找到了这篇文章,但没有提供解决方案:
最佳答案
在代码中的某个位置,您引用了必须获取 blob url 的 blob,将其传递给 FileReader像这样:
// Just an example file
var blob = new Blob(['abc'], {type: 'text/plain'})
var reader = new FileReader()
reader.onload = function() {
var base64data = reader.result
console.log(base64data)
}
reader.readAsDataURL(blob)
关于javascript - keditor 将 blob 生成的图像 URL 转换为 base64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48207704/