javascript - 如何在reactjs中将数据二进制转换为图像?
问题描述
解决方案
You can do this:
<img src={`data:image/*;base64,${props.generated}`} alt="generated motif" />
But you must ensure response from your API is something that can be decoded.
See PHP's base64_encode()
and this Stackoverflow answer.
推荐阅读
- drake - 用于 Python 的 Drake 二进制安装问题
- node.js - 2021 年的 Webpack4:编译 evm 反编译器 Nodejs 包而不会出现大量编译错误,因为 webpack5 可用
- typescript - Vue/Typescript:检查不是 HTMLInputElement 类型的属性
- powershell - Powershell命令识别所有Windows类型和UNIX类型的文本文件
- tensorflow - 使用 Tensorflow 的问题:检查模块中的 ERROR:root:Internal Python error。以下是此内部错误的回溯
- reactjs - Socket.io-client 在 React.js 中没有连接
- python - 带有 requests-html 和 aysnchronous 'render' 的 Spyder 中的 Python 是一场噩梦
- bluetooth-lowenergy - 我可以通过信标发送传感器(几个字节)吗?
- ios - 将 OOP 重构为面向协议的编程
- java - 更改父集 JPA 2 + Hibernate 5 后,孤儿不会被删除