Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

link for Image in admin/media

Solved by cvgrenoble View solution

Started by cvgrenoble 4 weeks ago · 3 replies · 252 views
4 weeks ago

Hello,

I'm a beginner...

I'm trying to display an image stored in “admin/media” on another page I created.

If I use the Markdown function in a markdown page, it works fine.

![incendie.jpg](media://incendie.jpg)

But if I use HTML function in a HTML page, nothing appears.

<img src="media://incendie.jpg">

Did I miss something ?

4 weeks ago

HTML doesn't do any processing it just renders as you write it.. and there's nothing to calculate what media://incendie.jpg means. I'm assuming you are trying to reference a media object in your template, using twig files, then you can use the media object to access it:

TWIG
<img src="{{ media['media://incendie.jpg'].url }}" /> 

this will render as:

HTML
<img src="/user/media/incendie.jpg" />

More info here: https://learn.getgrav.org/20/content/media#where-to-put-your-media-files

4 weeks ago

Thanks for your reply. I'll have to look through the documentation and try to figure this out.

4 weeks ago Solution

Solved, but in a noob way. The image is displayed using this path:

<img src="www.internetsite/user/media/incendie.jpg">

Suggested topics

Topic Participants Replies Views Activity
Support · by Rick Beebe, 5 days ago
2 94 1 day ago
Support · by blu3prince, 2 days ago
0 43 2 days ago
Support · by alex, 3 days ago
2 84 2 days ago
Support · by Marcel, 1 week ago
1 139 3 days ago
Support · by complanar, 5 days ago
4 124 3 days ago