# Unable to retrieve image when image name is code generated

**URL:** <https://discourse.psychopy.org/t/unable-to-retrieve-image-when-image-name-is-code-generated/26362>\
**Category:** Online experiments\
**Tags:** randomization, code, images, pavlovia\
**Created:** [December 7, 2021, 8:07am UTC](https://discourse.psychopy.org/t/unable-to-retrieve-image-when-image-name-is-code-generated/26362 "2021-12-07T08:07:38Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [December 7, 2021, 8:11am UTC](https://discourse.psychopy.org/t/unable-to-retrieve-image-when-image-name-is-code-generated/26362/2 "2021-12-07T08:11:15Z")

</div>

You need to either attach all the possible images via Experiment Resources / Online or use code to attach the ones you need.

> [@Downloading and checking resources on the fly](https://discourse.psychopy.org/t/downloading-and-checking-resources-on-the-fly/26256):
>
> URL of experiment: [spelling [PsychoPy]](https://run.pavlovia.org/Wake/spelling/) Description of the problem: I’m writing a spelling test where I want to download each word within the experiment. Since I’m now using 2021.2.3, I need to use psychoJS.\_serverManager.prepareResources() instead of psychoJS.downloadResources(); The following code seems to be working in principle (for the conditions file). psychoJS.\_serverManager.prepareResources([{name: conditionsFile,path: conditionsFile}]); If I put if(conditionsFile.exists()){ conti…

---

_[View the full topic](https://discourse.psychopy.org/t/unable-to-retrieve-image-when-image-name-is-code-generated/26362)._
