在 React 中显示从 Pinata 获取的图像

发布于 2025-01-10 03:33:26 字数 218 浏览 2 评论 0原文

我想从 Pinata 检索图像并将其显示在反应页面中。 这是图像:

https://gateway.pinata.cloud/ipfs/Qmc3gWiMKiRhnc61oSL3nR4Dg5NfJArNiQ2DZA6wpppKT4

我如何检索该图像并显示在

<img>

“提前致谢”中

I would like to retrieve an image from Pinata and display it in a page in react.
This is the image:

https://gateway.pinata.cloud/ipfs/Qmc3gWiMKiRhnc61oSL3nR4Dg5NfJArNiQ2DZA6wpppKT4

How can I retrieve this image and display in a

<img>

Thank you in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱的那么颓废 2025-01-17 03:33:26

如果图片网址是固定的,您可以嵌入它。或者,如果您从 API 获取它,则传递 imageUrlFetched 变量

<img src="https://gateway.pinata.cloud/ipfs/Qmc3gWiMKiRhnc61oSL3nR4Dg5NfJArNiQ2DZA6wpppKT4" />
<img src={imageUrlFetched} />

它会在您的网页中正确呈现它

You can embed the image url if it's fixed. Or pass a imageUrlFetched variable if you're fetching it from an API

<img src="https://gateway.pinata.cloud/ipfs/Qmc3gWiMKiRhnc61oSL3nR4Dg5NfJArNiQ2DZA6wpppKT4" />
<img src={imageUrlFetched} />

It renders it correctly in your webpage

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文