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 · 760 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 themetman, 1 day ago
6 74 6 hours ago
Support · by TomW, 2 weeks ago
8 286 4 days ago
Support · by alex, 3 months ago
8 703 4 days ago
Support · by Supple, 1 week ago
1 133 5 days ago
Support · by TomW, 2 weeks ago
3 208 6 days ago