I have some local images I want to use for the
key for my blocks.
I have had them set like
which was working, but now isn't.
I don't believe it's related to Payload, more likely a config issue. But I was wondering if there were some detailed docs on serving static assets in general?
Good morning @sam6466 I think this is the most relevant documentation:https://payloadcms.com/docs/upload/overview#enabling-uploads
Although, when serving content, depending on how your server is setup, you may need to create an nginx entry for the content
Happy to expand on that, but let me know if that part of the doc is helpful
Thanks. I’ll see if I need to setup an entry in the server.js. The weird part is this was working before and looking at the logs for the server and payload config, nothing changed. I’ll investigate further 😊
@sam6466 Do the assets show as 404? Can you access the image url directly and do they show?
Some other thoughts: Are the access controls for the upload collection set to allow public view?
No, the images 404. They are not part of an image collection as I want them to be served statically as the preview images for blocks, and they’re part of the repo. Before I was able to access them at /media/block-images/…
I had to add
app.use('/media', express.static(path.join(__dirname, 'media')));
to the server.js
Will try and dig into how this was working before
@sam6466 Let me know if you run into any more issues, happy to help troubleshoot