Skip to content
Grav 2.0 is officially stable. Read the announcement →
Support

link for Image in admin/media

Solved by cvgrenoble View solution

Started by cvgrenoble 12 hours ago · 3 replies · 40 views
12 hours 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 ?

11 hours 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

11 hours ago

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

7 hours 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 Paul Hodges, 4 weeks ago
19 512 1 week ago
Support · by Lauw, 1 week ago
2 120 1 week ago
Support · by Anna, 3 weeks ago
4 437 2 weeks ago
Support · by gtx, 4 weeks ago
4 387 3 weeks ago
Support · by Anna, 1 month ago
9 495 4 weeks ago