dynamicParams equivalent for next/image
Unanswered
Chartreux posted this in #help-forum
ChartreuxOP
Hi, quick question:
I have a page with Images on it. The images are stored locally and the path is loaded from my DB. That works as intended, but when I add new images to the folder and add the path to the DB, they don't load until I do a rebuild. Is there no chance that new ones are generated on demand, like with dynamicParams, where pages are rendered on build, but when I visit a dynamic route that was not rendered during build, it will render it on demand?
So I either would need to rerender everytime a new image gets added or don't use image optimizaition at all?
Thx 🙂
I have a page with Images on it. The images are stored locally and the path is loaded from my DB. That works as intended, but when I add new images to the folder and add the path to the DB, they don't load until I do a rebuild. Is there no chance that new ones are generated on demand, like with dynamicParams, where pages are rendered on build, but when I visit a dynamic route that was not rendered during build, it will render it on demand?
So I either would need to rerender everytime a new image gets added or don't use image optimizaition at all?
Thx 🙂
5 Replies
Brown bear
This is not possible. You need either a separate server or a 3rd party storage
"Only assets that are in the public directory at build time will be served by Next.js. Files added at request time won't be available. We recommend using a third-party service like Vercel Blob for persistent file storage."
Brown bear
(more specifically: https://github.com/vercel/next.js/releases/tag/v9.3.2)
ChartreuxOP
Thanks. I tried to go to the standard img tag, but not even this seems to work. I don't really want to use a 3rd party image storage