Umbraco Razor Helper : Media Url

Returning the media item url which can be used in an image tag

Posted on Tuesday, September 24, 2013


Using 6.x within razor views:

@Umraco.Media(id|string).Url

Example

@Umbraco.Media(@CurrentPage.NewsImage.ToString()).Url

will return the media item url which can be used in an image, e.g. :

<img src="@Umbraco.Media(@CurrentPage.NewsImage.ToString()).Url" alt="" />