Post
Share your knowledge.
How to Use toGatewayURL to Save NFT Image URL for Image Component?
I am trying to utilize toGatewayURL
to save the URL from an NFT image for use in an Image Component. However, I am unsure of what to specify as the gateway parameter in the function call. I have attempted to use hanlo.mypinata.cloud
as the gateway, but it does not work. Additionally, I have a token available for use with the gateway. How can I correctly configure toGatewayURL
with the appropriate gateway and token to save the NFT image URL?
- IPFS
- JavaScript
- NFT.Storage
Answers
1The library that provides the toGatewayURL
function is NFT.storage. However, Pinata also offers extensive gateway information on their documentation page at https://docs.pinata.cloud/docs/gateways-page.
It appears that the toGatewayURL
function requires a gateway URL and an IPFS CID to generate a functional URL. While using a generic gateway like "https://dweb.link/" should suffice, leveraging Pinata's dedicated gateways may offer better performance if you are already utilizing their services.
Do you know the answer?
Please log in and share it.
The InterPlanetary File System (IPFS) is a protocol, hypermedia and file sharing peer-to-peer network for storing and sharing data in a distributed file system.