Use a database file path with img_tag

With Rails I would have just written <%= image_tag modelName.thumb_path %> to display an image from each individual record, where thumb_path is the field in the db where I store a string such as image1.jpg

With Phoenix, I’ve been trying <img src="<%= img_tag(post.thumb_path) %>"> and also just <%= img_tag(post.thumb_path) %> but I can’t get the image to show.

I imagine I’m missing something simple, but what?

Can you show us the actual page source output?

Added a screenshot from the browser. Is that what you meant?

Try right clicking the image and clicking “open in new tab”. Does the image show (or do you get a 404 or some other error)?

File not found.

It loads the correct string from the db, but looks like the path was wrong. Updating the string to /images/image.jpg has resolved it.

Thanks.