With this code below you should get what you are after.
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@*
How it works:
- Confirm the macro parameter has been passed in with a value
- Display any individual image
Macro Parameters To Create, for this macro to work:
Alias:mediaId Name:Select folder with images Type:Single Media Picker
*@
@{ var mediaId = Model.MacroParameters["mediaId"]; }
@if (mediaId != null)
{
@* Get the media item associated with the id passed in *@
var media = Umbraco.TypedMedia(mediaId);
<img src="@media.GetPropertyValue("umbracoFile")" alt="@media.GetPropertyValue("Name")" />
}
Remember to add the parameter to the marco, and the important thing here is the alias of the parameter.
Model.MacroParameters["ImagesToRender"]
Dear Umbraco Forum Team
How do I render media image from macro parameters in a view using strongly typed Model.Macroparameters["ImagesToRender"]
Thanks Dibs
Hi Dibs,
With this code below you should get what you are after.
Remember to add the parameter to the marco, and the important thing here is the alias of the parameter.
Hope this helps,
/Dennis
Cheers Dennis
works a treat
Dibs
is working on a reply...