Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I want to get a simple URL of a media image in Razor.
How do you do this?
I had to resort to c# code which seems like an overkill:
@MediaFunctions.GetURL(1099)
which called
public class MediaFunctions { public static string GetURL(int mediaId) { string url = ""; var media = new umbraco.cms.businesslogic.media.Media(mediaId); var file = media.getProperty("umbracoFile"); url = (string)file.Value; return url; }
Is there a way to do it without calling custom code?
Can you show your xml form umbraco.config inside your App_Data Folder?
you could easily access the umbracoFile with the . notation
<img src="@Model.anotherNode.yourProperty.umbracoFile" />
You can do this easily with :
<img src="@Model.MediaById(1099).umbracoFile" />
or this way :)
Woo hoo
@Model.MediaById(1099).umbracoFile
that works!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How do you get a Media Image URL without c# code?
I want to get a simple URL of a media image in Razor.
How do you do this?
I had to resort to c# code which seems like an overkill:
which called
Is there a way to do it without calling custom code?
Can you show your xml form umbraco.config inside your App_Data Folder?
you could easily access the umbracoFile with the . notation
<img src="@Model.anotherNode.yourProperty.umbracoFile" />
You can do this easily with :
or this way :)
Woo hoo
@Model.MediaById(1099).umbracoFile
that works!
is working on a reply...