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
I'm trying to create a slide show for my site which shows all the images on the site. Can anybody help me with the razor code for getting a list of all media of type "Image"?
My code for getting a specific image goes like this
var image = Umbraco.TypedMedia(1080); string imgUrl = image.GetPropertyValue<string>("umbracoFile"); <img src="@imgUrl" />
You could:
var images = uQuery.GetMediaByType("Image");
And then:
@foreach (var img in images) { var image = Umbraco.TypedMedia(img.Id); string imgUrl = image.GetPropertyValue<string>("umbracoFile"); <img src="@imgUrl" /> }
Hope it helps.
Thanks Dennis, exactly what I was looking for!
Great to hear! Glad it helped! :)
´wink´ Mark as solution. :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
List all images in Media
I'm trying to create a slide show for my site which shows all the images on the site. Can anybody help me with the razor code for getting a list of all media of type "Image"?
My code for getting a specific image goes like this
You could:
And then:
Hope it helps.
Thanks Dennis, exactly what I was looking for!
Great to hear! Glad it helped! :)
´wink´ Mark as solution. :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.