Hey guys. How do you associate an image with a JSON object? Like loading the right profile pictures for example. Is there a way to do that without the need for a database? (Of course there will be the images in a folder)
You could do this by using the path to the image:
[
{
"image": "static/images/image1.jpg"
},
{
"image": "static/images/image2.jpg"
}
]
1 Like
Thank you! Will try that.
You’re welcome. You will of course need the correct path to you image folder. The one I gave is just an example. If it doesn’t work let me know and I’ll try to help further
Of course I will specify the right path. I’ll reply to this thread if I encounter any issues.
1 Like
hey no it didn’t work
Do you have a repo you could share?
I’ve initialized one here - https://github.com/kirubiel/random-quote-machine
Oh never mind I have it working. I messed up with the getElementById
.
1 Like