Skip to content
● Grav 2.2 is out: 2x faster cold starts and 96% less memory on big sites. Read the announcement →

link for Image in admin/media

Solved by cvgrenoble View solution

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

2 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

2 months ago

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

2 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 webmasterodp, 2 days ago
4 87 1 day ago
Support · by nwhitfield, 4 days ago
2 85 3 days ago
Support · by stell, 2 weeks ago
5 327 7 days ago
Support · by gravinator, 1 month ago
5 524 7 days ago
Support · by Gravver, 3 weeks ago
6 325 2 weeks ago