I currently cannot get my .cshtml code to pull my image's url and name at the moment at the moment. Here it is:
@inherits umbraco.MacroEngines.DynamicNodeContext @if (Model.HasProperty("image") && Model.Image != 0) { <p>Advanced: <br /> @{ var image = @Model.Media("image"); } <img src='@image.Image' alt='@image.Name' /> </p> } else { <p> This page doesn't contain a MediaPicker property with the alias of 'RelatedMedia' or No image is selected on this page </p> }
Get an image's url and name with Razor
I currently cannot get my .cshtml code to pull my image's url and name at the moment at the moment. Here it is:
@inherits umbraco.MacroEngines.DynamicNodeContext
@if (Model.HasProperty("image") && Model.Image != 0) {
<p>Advanced: <br />
@{
var image = @Model.Media("image");
}
<img src='@image.Image' alt='@image.Name' />
</p>
} else {
<p>
This page doesn't contain a MediaPicker property with the alias of 'RelatedMedia'
or No image is selected on this page
</p>
}
I use the following helper method, you should be able to take the relevant code out of it:
Hope this helps
is working on a reply...