Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
hello our.Umbraco Community
I've got a problem with my Multiple Media Picker. I want to read out all my pictures in a Partial View with Razor.
@{ var mediaIds = Model.Content.GetPropertyValue("pictures"); } @if (mediaIds != null) { <div class="imageSlider noBottom"> <div class="container"> <div class="swiper-container"> <div class="swiper-wrapper"> @foreach (var mediaId in mediaIds.ToString().Split(',')) { var media = Umbraco.Media(mediaId); @* a single image *@ if (media.DocumentTypeAlias == "Image") { @Render(media); } @* a folder with images under it *@ if (media.Children("Image").Any()) { foreach (var image in media.Children("Image")) { @Render(image); } } } </div> </div> <div class="sliderButtons"> <img src="img/galerie_arrow_left.svg" class="button-prev" alt="Slider left"/> <img src="img/galerie_arrow_right.svg" class="button-next" alt="Slider right"/> </div> </div> </div> } @helper Render(dynamic item) { <div class="swiper-slide"><img src="@item.umbracoFile alt="Slider image"/></div> }
With: @{ var mediaIds = Model.Content.GetPropertyValue("pictures"); } i don't get the meidaIds of my Items, does someone know why this happens?
Kind Regards Tim Gerhard
Hi Tim
What version of Umbraco are you using? Did you enable property value converters?
Thanks,
Alex
Nevermind i found it out myself with the help of coworkers & Stack overflow.
For the ones that are looking for the code i've used: (Works in Umbraco. 7.6.6)
@{ var typedMultiMediaPicker = Model.Content.GetPropertyValue<IEnumerable<IPublishedContent>>("pictures"); foreach (var item in typedMultiMediaPicker) { <img src="@item.Url" alt="image" /> if (item.DocumentTypeAlias == "Folder") { foreach (var image in item.Children("Image")) { <img src="@image.Url" alt="image" /> } } } }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Multiple Media Picker in Umbraco 7.6.6
hello our.Umbraco Community
I've got a problem with my Multiple Media Picker. I want to read out all my pictures in a Partial View with Razor.
With: @{ var mediaIds = Model.Content.GetPropertyValue("pictures"); } i don't get the meidaIds of my Items, does someone know why this happens?
Kind Regards Tim Gerhard
Hi Tim
What version of Umbraco are you using? Did you enable property value converters?
Thanks,
Alex
Nevermind i found it out myself with the help of coworkers & Stack overflow.
For the ones that are looking for the code i've used: (Works in Umbraco. 7.6.6)
is working on a reply...