forget about the lightbox gallery. I just want to have the paths of my images. For example you can get it out with <p>@item.xxx</p> or something like this.
I think that would suggest the property mediaIds is not returning an IEnumerable<int>. Outputing @galleryItem.GetProperty("mediaIds").Value.GetType() will probably tell you what it is.
item.MediaIds I think is going to be a collection of ids rather than a single one but I could be wrong.
You could try outputing @item.MediaIds.GetType() to tell. If I'm right than this might help:
@foreach (var mediaId in selection.SelectMany(s => s.MediaIds)){
}
However they will give you an id (e.g. 1001) not the URL that you're after. You'll need to first convert 1001 in to a media item
var mediaItem = Umbraco.Content(mediaId)
and then you'll need to get the URL of that item e.g.
@mediaItem.Url
It might be getting ahead of ourselves but you might want to output a URL that returns a scaled image (see here).
Mediapicker in Combination with Lightbox Gallery
Hello ourCommunity
I have a Problem with the Mediapicker (with multiple images)
i want to make a gallery with lightbox.
i have 2 Document Types the first one is the bilder (german for images^^) and the bilder_item document type.
This is Bilder
and this is bilder_items
now my Problem is how do i get the images-paths of all picked images of bilder_images into my bilder documenttype? (all picked images of "MediaIds")
i think i have to make a macro and put : @Umbraco.RenderMacro("listBilder")
into my "Bilder" Template.
can someone give me a hint how i get the paths?
thank you.
Can I suggest that you use Nested Content. This means that your bilder_items are items within a Bilder property rather than children.
You then just need to do:
Or something like that anyway
what does the ("myLightboxGallery") stand for?
forget about the lightbox gallery. I just want to have the paths of my images. For example you can get it out with
<p>@item.xxx</p>
or something like this.EDIT: i mean in an foreach like this:
no i don't use nested content.
im working with this method: https://our.umbraco.org/documentation/tutorials/creating-basic-site/articles-parent-and-article-items
Ignore myLightboxGallery if you're sticking with your approach.
So you'll need something like this:
sorry i'm new to umbraco.
now it says: there is no definition for "TypeContent"
why?
EDIT:
is it right to make a Makro and then in my "Bilder" Template i make:
@Umbraco.RenderMacro("listBilder")
and the makro looks like this:
Because it should be TypedContent. Sorry
oh, i didnt see that. thank you
um now there is a new error now.
I think that would suggest the property mediaIds is not returning an
IEnumerable<int>
. Outputing @galleryItem.GetProperty("mediaIds").Value.GetType() will probably tell you what it is.please help
but the @item.MediaIds doesn't work :/
it could be something like this.. not?
item.MediaIds I think is going to be a collection of ids rather than a single one but I could be wrong.
You could try outputing
@item.MediaIds.GetType()
to tell. If I'm right than this might help: @foreach (var mediaId in selection.SelectMany(s => s.MediaIds)){ }However they will give you an id (e.g. 1001) not the URL that you're after. You'll need to first convert 1001 in to a media item
and then you'll need to get the URL of that item e.g.
It might be getting ahead of ourselves but you might want to output a URL that returns a scaled image (see here).
no i don't need a scaled image.
and outputing @item.MediaIds.GetType() gives: System.String
or did i do something wrong?
EDIT: @galleryItem.GetProperty("mediaIds").Value.GetType() is also System.String
okay now i get it i think. If i make
it puts out: 1197,1200,1198,11991197,11981199,1266,1200 etc. (image ID if i understood you right)
and now how do i get the URLs out of that "array maybe?"
i got it! finally^^
thank you very much for supporting
I'm not sure TBH. You're using dynamics which I've not used for a while but let's go with this:
oh yes this is the shorter version, thank you so much
Great. Well done
is working on a reply...