Unknown resources when setting the image of ImageStim

URL of experiment: https://gitlab.pavlovia.org/LuLeng/vind-jouw-vriend

Description of the problem:

I’m getting the following error when trying to test my paradigm online

  • when setting the image of ImageStim: FunScale
  • when getting the value of resource: Images/Fun0.png
  • unknown resource

Images/Fun0.png is from the variable Present_FunScale, created with the following line of code:

Present_FunScale = 'Images/Fun' + str(N_correct) + '.png'

The image component then has $Present_FunScale, set every repeat

Putting the same path directly into an image component finds the image with no problem

Apparently, we can find solutions to most of our errors in this document.

I followed the instructions: Use experiment settings > online > +/- keys to add the list of resources your experiment will need (2020.2.6 onwards).

For those who don’t know yet, the experiment settings on the top panel of the builder. Once you added your images, synchronize your experiment again. Then it should work.

However, the pictures never get fully synchronized for my study. So I had to manually add the resources that I need to the JavaScript codes. The resources should be added to this section of your JavaScript.

expName: expName,
expInfo: expInfo,
resources: [


1 Like


Thank you for plugging my crib sheet.

I’m interested to know why adding the resources didn’t work for you. I know there was an issue with images in sub folders in early versions of this option. What version are you using?

Off the top of my head I can’t remember whether you need to specify the path or just the filename, if you have added files via experiment settings.

Also, are you suggesting editing the JS file directly. Is the resources option deliberately empty or did you fill it with your image names? What did it look like before?

Now I just checked my version. It is 2020.2.5… I guess that’s why it didn’t work with the solution you provided.

When I added all the pictures I used via the experiment settings, I just clicked ‘+’ and selected the pictures I need. I didn’t manually add the filenames or the pathy. When I synchronized the task afterwards, only some pictures were synchronized to the corresponding folder on gitlab and exactly the ones that were unknown were not there.

So I looked into the two JS files directly (.js and -legacy-browser.js), and the resources option was not empty but included all the resources uploaded on gitlab (both filenames and the paths). So I followed those codes and added the missing pictures I need. I also manually uploaded those pictures in the resources folder on gitlab. Then the task runs smoothly.

However, when I made some changes in Builder and synchronized the task again, the two JS files came back to the older version. So now I have to update the JS files and synchronized them every time I synchronized the task in Builder.

I know these steps sound tedious and stupid, but at least it worked. :rofl:

This was very useful for me as I ran into a similar issue. Thank you for detailing the solutions and referring us to the js crib sheet!

1 Like