P5js web editor - assets folder


The assets in the sketch folder don’t seem to be loading. The sketch hasn’t been edited for weeks, and was working fine until a couple days ago. I wonder if there is some sort of expiration date on the images in the assets folder?

Anyway, if you check the web browser’s console error log it shows all the images can’t be found. This is also strange because if I open the images inside the editor’s assets folder, they all appear just fine.

Any ideas? Let me know.

bgIMG = loadImage('assets/bg.jpg');

There’s no subfolder called “assets/”. Those images are all in the root folder. :file_folder:

1 Like

I followed the reference provided here, which also includes the assets folder: https://p5js.org/reference/#/p5/loadImage

Again, it worked when I created the code weeks ago. It just recently failed to load. For this reason, the code that is written shouldn’t be an issue. But if it is, how would you write it?

I don’t use that online editor. Got no idea why it woulda worked back then. :man_shrugging:

bgIMG = loadImage('assets/bg.jpg'); :arrow_right: bgIMG = loadImage('bg.jpg');

I see. I must have messed up when I tried that earlier, but you’re right it is in the root because I just tried it again and it worked. Well, sorry for wasting your time!