Images are not showing up when shiny app is deployed. Shiny app is not recognizing image folder.

I have a shiny app with a section that shows images depending on the user input. While it works well on my local machine, when I deploy to shinyapps.io, the images do not show up as I get the following error -

Warning: Error in : [ENOENT] Failed to search directory 'bike_img': no such file or directory

It appears the folder bike_img is not being detected. I also noticed that when I click the button to publish to shiny, I don't see I do not see the image files included in the file section. So I manually added one of such image files (jpg file at the bottom). When I do so and publish, that particular image shows up.

Screen Shot 2022-10-16 at 2.47.00 PM


Here is my app folder structure -
projectFolder


Here is the code in the app that references the bike_img folder. I list the contents of the directory with the dir_ls(), then detecting a file that matches a pattern, all within a renderImage() function
renderImage


My question is, what do I do to ensure the app is recognizing the bike_img folder with images? I have over 100 images so adding them manually is a pain.

Update! I add the following code resource_files: bike_img/ to my .Rmd file and this appeared to fix the problem. If there is a better solution please do share.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.