Converting from java to p5js, not working as intended

My script uses images. If I run it using the local server p5js app provides, it runs perfectly fine but I can not have my site properly set up. I have tried using codepen and some other apps for it but none have let me use images in my code so far.

Image 1 is me running the script using p5js program
image 2 is me running the html file