Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

link for Image in admin/media

Solved by cvgrenoble View solution

Started by cvgrenoble 3 months ago · 3 replies · 623 views
3 months 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 ?

3 months 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

3 months ago

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

3 months 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 Anna, 4 days ago
1 89 4 days ago
Support · by Anna, 3 weeks ago
1 260 3 weeks ago
Support · by webmasterodp, 1 month ago
4 378 1 month ago
Support · by nwhitfield, 1 month ago
2 349 1 month ago
Support · by stell, 2 months ago
5 654 1 month ago