jbx-protocol / juice-interface

🧃 An app for using the JBX protocol.
https://juicebox.money
MIT License
195 stars 126 forks source link

Image sizes from IPFS on production are huge #2669

Closed benschac closed 1 year ago

benschac commented 1 year ago

Summary

CleanShot 2022-12-08 at 21 53 09@2x

The end user is downloading something like 3MB from pinata / ipfs

I have a PR addressing this shortly

Steps to reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

What is the current bug behavior?

What is the expected correct behavior?

Relevant logs and/or screenshots

Environment

benschac commented 1 year ago

Did a bit more research here. Problem: load a giant file on a payment. Any user who hits landing will endup downloading the entire file which will result in a slower load time and probably a higher IPFS/Infura bill.

image

Pinata has an image optimization product / feature.

docs: https://docs.pinata.cloud/gateways/image-optimization#pinata-image-optimization and I implemented it in this PR: https://github.com/jbx-protocol/juice-interface/pull/2679

this could be out dated but, it doesn't seem like there's anyway to resize images directly from IPFS.

https://community.infura.io/t/ipfs-gateway-image-optimization/5487

also noticed we're nixing pinata everywhere so it doesn't matter: https://github.com/jbx-protocol/juice-interface/pull/2687/files

I did see a solution with cloudflare workers that looked promising: https://developers.cloudflare.com/images/image-resizing/resize-with-workers

wyat @tomquirk

tomquirk commented 1 year ago

Closing this for now as its low prio