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 1 week ago · 3 replies · 179 views
1 week 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 ?

1 week 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

1 week ago

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

1 week 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 Roger Parkinson, 5 days ago
3 181 21 hours ago
Support · by gravinator, 2 days ago
2 108 1 day ago
Support · by Marcel, 1 week ago
4 198 5 days ago
Support · by Paul Hodges, 1 month ago
19 608 3 weeks ago
Support · by Lauw, 3 weeks ago
2 210 3 weeks ago