next-optimized-images icon indicating copy to clipboard operation
next-optimized-images copied to clipboard

Building static images ahead of time for dynmaic retrieval in code [canary]

Open guy-kdm opened this issue 3 years ago • 2 comments

I want to require images using a function that constructs the image name. I know all the image URLs that would be required in advance. Should I use a code-gen plugin to create a code file with all the URLs required() and than let the plugin do the rest?

guy-kdm avatar Aug 09 '20 15:08 guy-kdm

This is a planned feature of the next major version (#120), but I haven't started on that particular feature yet. So until that feature is out, I think your solution would be the best way to solve that problem.

cyrilwanner avatar Aug 10 '20 10:08 cyrilwanner

Cool, since I need to dynamically create the image url, I'm back to building a sharp script for now. This needs to create images with sizes in sync with the layout (and add a hash ext). I'd love there to be a standard way for Next.js to keep that "image script config" colocated in the layout, while allowing me to dynamically build the URL.

guy-kdm avatar Aug 11 '20 11:08 guy-kdm