1
votes

I'm trying to display an image using <%= img_tag("/media/image_test.png") %> the image_test.png is located in the folder "media" that is located on the root of my project folder named "practice".

But I'm getting error no route found for GET /media/image_test.png.

Below is the content of my files:

practice/media/image_test.png

Image

practice/lib/practice_web/templage/index.html.eex

<%= img_tag("/media/1570573826060_.png") %>

It's clear that the image path is not corect.

Can you please help?

1

1 Answers

1
votes
<img src="<%= static_path(@conn, "/media/1570573826060_.png") %>">

Try this one, you should access those with the static path