Images not displaying in storefront

I have created a plugin that displays images from a folder in the storefront in the footer. I used the following tutorial for guidance:

However, my storefront is not showing those images.
In my task, I created a random function that picks out one image randomly from the directory. The directory and the function can be seen here:


However, this ends up giving an error:

I suspect that the array is empty because it can not brows through the directory.
Kindly help me with this.