Hello! Here my first app for upload images

Hi,

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
Mobile:

  • ~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)

Proyect: https://simple-image-upload-ipfs.vercel.app/
Repo: GitHub - jonallamas/simple-image-upload-ipfs: Simple app for upload and share images with IPFS

Any comment or suggestion is welcome :blush: i’m front-end developer

Analytics by Vercel for Mobile:


Analytics by Vercel for Desktop:


1 Like

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.

1 Like

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.

1 Like

Thanks Daniel!
I’m not knowing web3.storage

So I would have to do ipfs.add and ipfs.pin ?

Thanks!

You say add a 2nd share button? I don’t understand :sweat_smile:

no no.
Just an option to share same url using any public gateway, say cloudflare gateway.

1 Like

Change .com/cid/QmP... by .com/QmP... ?

Great question.

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?

Screen Shot 2022-05-21 at 12.32.28

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.

1 Like

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.

1 Like