Using photos from local machine in VScode

Hello everyone, I know this is not exactly a programming help question but I can’t find a solution anywhere else.
I need to reference a photo on my local machine and use it in my react project.

title: 'Neolithic Rock art',
          imageUrl: 'C:\Users\Me\Desktop\Master Folder\CODING\React lesson\Eshop\eshop\src\Pages\Item-Pages\Photos\Neolithic\art.jpg',
          Price: '$300',
          id: 1,

I can only get an image to work if it has an external url, how do I reference a photo that I have saved in a folder?
Thank you in advance.

1 Like

If you have your images in Public folder, then’images’ folder it would be like this:

src={process.env.PUBLIC_URL + '/images/photo.png'}

If you want to keep them like you have, it would be:


(assuming your .js file is in src folder)

basically the ./ ../ path references

1 Like

For some strange reason this method isn’t pulling up the photo.
And the usual autocomplete when i type …/ isn’t working either. I am going to move the photos around and try a few more things

1 Like