Issue with loading images

When I run this program with the editor, it works fine. But when I download the files and try to use Chrome to run the program, it just says “Loading…” but it never loads. It works fine in other browsers.

How do I fix this?


Adding stuff to exceed character minimum.

The sketch works online. Okay. But not locally?
Can you run P5.js examples without issue?
What errors (if any) are showing in the Chrome Console? (Hit F12).

I can run most p5 sketches locally, but it seems that when I try to load Images in preload, It just displays this:


If I don’t do it in preload it doesn’t display the images, but it displays the rest of the sketch.

There are warnings in the console, but I get these with every sketch.

It doesn’t get access to your image. See if you changed the String in loadImage, or if you misplaced/deleted the image in the assets folder. Or renamed the folder.
Edit: Maybe you need to change the String to match your local path.

The path matches, it works in firefox and edge, and the image is still there. GoToLoop, your sketch works, and I tried modeling my code after yours, but It still didn’t work. Is there a way I can download the code to test it?

It worked when I used a python server instead of opening the HTML file, that must be the problem. Thanks for your help!

1 Like

1 Like