I uploaded a folder, “app/assets/images/FlagIcons”, of PNG images but they won’t display in my rails app. It just shows a broken image with the correct alt label.
I can open the files in the directory so that’s not an issue.
My code is as follows
<%= image_tag(/app/assets/images/FlagIcons/France.png) %>
The html is
img src="/app/assets/images/FlagIcons/France.png" alt=“France”
I have tried alternative file paths such as “assets/images/FlagIcons/France.png” but the result is always the same.
I solved this by trial and error. I got it to work when I moved all of my images from the flagicons folder into the assets/images folder and used <%= image_tag(france.png) %>. The capital letters in my original paths might have been a problem.