mattrosno / carbon-platform

carbon-platform-git-main.mattrosno.vercel.app
0 stars 0 forks source link

next/image Image component can only serve images from the public directory #8

Open mattrosno opened 3 years ago

mattrosno commented 3 years ago

https://nextjs.org/docs/basic-features/image-optimization

https://nextjs.org/docs/api-reference/next/image

You can't have images that live alongside your MDX files, for example.

https://stackoverflow.com/a/63659100/2166839

mattrosno commented 3 years ago

Next.js's image component also can't take a stream / buffer. Interestingly, Cloudinary can. If sourcing images from GitHub repos, either we:

  1. Write images to /public
  2. Use GitHub direct URLs to images in src props (but if those repos are GHE, that means you'd need to be w3 authenticated to view) E.g. https://raw.githubusercontent.com/mattrosno/carbon-library-common/3012db51020b2d3807c802da81e85f7c339fe030/components/accordion/images/accordion-alignment-do.png
  3. Upload image buffers to Cloudinary to host all of our images

https://support.cloudinary.com/hc/en-us/community/posts/360007581379-Correct-way-of-uploading-from-buffer-