Use static folder to store images fetched from CMS in getStaticProps #15622
Unanswered
franciscorubin
asked this question in
Help
Replies: 1 comment
-
I guess you would need to copy them where ever images located in /public get copied when building the site. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm developing a website that fetches data from a CMS on getStaticProps. One of the fields it fetches is a list of pictures in binary format.
Currently I'm converting the pictures to base64 and appending them directly into the html, but that increases the html size by a lot and makes the website's load very slow.
As a solution, I would like to store the images I fetch on every build, and just pass the paths to the html.
Is there a good practice to do this? It seems like a common scenario.
Would copying the file to /public work?
Thank you!
EDIT: I've seen recommendations of using S3 or any external file system. I'd like to avoid this added complexity if possible. Ideally this should just store the fetched images on .next/static/images like the rest of the images of the website. The fetching will only happen on build time (getStaticProps), so this shouldn't be a problem technically.
Beta Was this translation helpful? Give feedback.
All reactions