Does your code for retrieving "backImage" return anything? I can't quite tell from the image whether you're in a partial or in a template with the model where this image is located.
Once you've got the field, depending on your version of Umbraco and whether Property Value Converters are enabled you may need to convert the Media id to a media object and then get it's URL.
@{
var backgroundUrl = String.Empty;
var backgroundImage = Umbraco.TypedMedia(Model.Content.GetPropertyValue<int>("backImage"));
if (backgroundImage != null)
{
backgroundUrl = backgroundImage.Url;
}
}
Image picker
I tried to get the page background image using media picker. I use the below code. but it does not work. Is there any other code to it?
Hi,
Does your code for retrieving "backImage" return anything? I can't quite tell from the image whether you're in a partial or in a template with the model where this image is located.
Once you've got the field, depending on your version of Umbraco and whether Property Value Converters are enabled you may need to convert the Media id to a media object and then get it's URL.
is working on a reply...