Reputation: 105
I'm trying to ref a published image in Umbraco but 'MediaById' seems to be incorrect, what is the correct way to reference this?
<img src="@Model.MediaById("focusImage") alt="@Model.GetPropertyValue("focusAltText")/>
Upvotes: 0
Views: 96
Reputation: 3536
Try
@{
var mediaId = Model.GetPropertyValue<int>("focusImage");
var media = Umbraco.TypedMedia(mediaId);
}
<img src="@media.Url" alt="@Model.GetPropertyValue("focusAltText")/>
Upvotes: 2