I have set up a small project to upload images to IPFS. The node is with NextJS in a context and everything is great. I was doing performance tests on different devices, and on mobiles the older, the more difficult to process the information
Desktop: ~7/9s in Macbooks
- ~2s iPhone 13 Pro Max
- ~8s iPhone 11
- ~10s iPhone 8
- ~30s Samsung A52
- Never init in Motorola G8 Power Lite
All tests were performed on: Upload image to IPFS
Image taken from the Apollo 12 project. Image: 2mb (4400 × 4430)
Repo: GitHub - jonallamas/simple-image-upload-ipfs: Simple app for upload and share images with IPFS
Any comment or suggestion is welcome i’m front-end developer
Analytics by Vercel for Mobile:
Analytics by Vercel for Desktop:
This is great stuff!
You could take this further and use a bunch of services like Pinata, infura and web3.storage to pin the CID after it’s been added to the network.
Awesome work @unllamas
When image is uploaded to IPFS, the UI shows button to “See Image”.
It will be better if you provide option to copy publicly sharable link with any available public gateway.
I’m not knowing web3.storage
So I would have to do
You say add a 2nd share button? I don’t understand
Just an option to share same url using any public gateway, say cloudflare gateway.
When a file is added to the new IPFS node that you instantiated in the browser, there’s a good chance that even if you upload the file and it’s cached on some of the bootstrap servers, after a while the CID will be garbage collected and won’t be available after that.
By using a pinning service, you basically ask services that operate IPFS nodes to keep the file available to the network.
As @Galactus suggested, you could also share a link to view the file from a public gateway
What is the purpose of pinning a file?
I understand that the CID derives from the file’s metadata, so only by obtaining the CID can I generate a file, right?
In this way it does not depend on nodes that have the file, but on the CID itself.
It is valid?
No. That’s not true. You can’t generate the file just by using it’s CID.
If the IPFS network (on any public connected node, globally) has the file, you can fetch the file by using it’s CID. But if no one has the file, it’s impossible to reconstruct the file from CID.
As @Galactus pointed out this is not possible. Generating the CID is a “one-way function” meaning that you cannot derive the original data just from the CID.
You need at least one node to have the file to retrieve it.