Display Image from Media Library in Umbraco 7
Thanks Jesus Mogollon,
I've collapsed that to:
<img src="@Umbraco.Media(CurrentPage.headerBackgroundImage).Url" alt="">
I've set the file to mandatory so hopefully I wont need the if statement part.
I found this way easy and clean:
@if (CurrentPage.Image != null && !(CurrentPage.Image is Umbraco.Core.Dynamics.DynamicNull))
{
var m = Umbraco.Media(CurrentPage.Image);
<img src="@m.Url" alt="@m.UrlName" />
}
I hope that it helps somebody else