How to do the path for the custom image to the block field

default discord avatar
mistermaddog
4 months ago
5

I have something like this:


blocks:[
  {
    imageURL: "../images/mediaAndText.jpg",
  }
]


Causing an issue like in the attached screenshot.



I'm probably missing something obvious here?



Also here is my project structure

  • discord user avatar
    denolfe
    Payload Team
    4 months ago

    In your console, what URL is it trying to resolve for the images?



    Relative paths won't cut it here. You'll have to point it to where they're served from

  • default discord avatar
    mistermaddog
    4 months ago

    @denolfe, you're right and can I serve it from Payload or do I need to upload it to somewhere else? Here is what I get as the image source:

    <img src="../images/mediaAndText.jpg">
  • default discord avatar
    akshay
    4 months ago

    You'll need to configure

    /images

    as static directory using express.static

    https://expressjs.com/en/starter/static-files.html

    and then you can use something like

    /images/mediaAndText.jpg
Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.