I ran into a problem using the multiple media picker.
I have this website structure:
In "Galleri One + Two" I use the multiple media picker to choose images. I can manage to show the images from "Galleri One", but how can I show images from both "Galleri One + Two" on the same page?
I want to show all images and then the visitor can sort the images by clicking on buttons with the names "Galleri One + Two".
My code that shows the images from "Galleri One" looks like this:
@{
var pictures = CurrentPage.Down(1);
}
@if (pictures.HasValue("testImages"))
{
var caseStudyImagesList = pictures.testImages.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
var caseStudyImagesCollection = Umbraco.Media(caseStudyImagesList);
foreach (var caseStudyImage in caseStudyImagesCollection)
{
<img src="@caseStudyImage.Url" style="width:300px;height:300px" />
}
}
From the code in your post it looks to me that the current page is gallery and then you want to loop though the children and display the images in a property that uses the multiple image picker.
This code below should do exactly what you are trying to do.
@{
var items = CurrentPage.Children;
}
@foreach(var pictures in items.Where("Visible")){
if (pictures.HasValue("testImages"))
{
var caseStudyImagesList = pictures.testImages.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);
var caseStudyImagesCollection = Umbraco.Media(caseStudyImagesList);
foreach (var caseStudyImage in caseStudyImagesCollection)
{
<img src="@caseStudyImage.Url" style="width:300px;height:300px" />
}
}
}
Show all images from every childpage
Hi everybody
I ran into a problem using the multiple media picker.
I have this website structure:
In "Galleri One + Two" I use the multiple media picker to choose images. I can manage to show the images from "Galleri One", but how can I show images from both "Galleri One + Two" on the same page? I want to show all images and then the visitor can sort the images by clicking on buttons with the names "Galleri One + Two".
My code that shows the images from "Galleri One" looks like this:
Thanks in advance!
// René
Hi Rene,
If you are on the Galleri page then you can get the images list by using its children.
And on the galleri one page you can have the sibling of that node.
So you can loop through siblings and get images.
For Ex:
Hope this will help.
Regards, Urvish Mandaliya
Hi René
From the code in your post it looks to me that the current page is gallery and then you want to loop though the children and display the images in a property that uses the multiple image picker.
This code below should do exactly what you are trying to do.
Hope this helps, and make sense.
/Dennis
Hi Dennis
I could just copy in your code and it worked perfectly.
Thank you!
// René
is working on a reply...