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
Have a data type defined with many values, one being a media picker.
This gets the data:
@{ Layout = "master.cshtml"; var players = Umbraco.Content(Guid.Parse("<uniqueid>")) .ChildrenOfType("player") .Where(x => x.IsVisible()); }
This mostly works:
@foreach(var player in players) { <div class="col-md-4 py-1"> <a title="#@player.Value("primetimeJerseyNumber") - @player.Value("playerName") - @player.Value("playerHighSchool")" href="@player.Url()"><img src="@Umbraco.Media(player.Value("playerProfileImage"))" class="rounded-lg" /></a></div> }
What is not working is figuring out how to get the profile image.
Have tried many variations:
@Umbraco.Media(player.Value("playerProfileImage")) @Umbraco.Media(player.Value("playerProfileImage")).Url @Umbraco.Media(player.Value("playerProfileImage")).Url() @player.Value("playerProfileImage").Url() @player.Value("playerProfileImage").Url
And others, what am I missing here?
Fought with this for most of a day, can't find the magic sauce. Help is appreciated.
I have it working, why did I need to make the call into two lines?
@foreach(var player in players) { var imageUrl = player.Value<MediaWithCrops>("playerProfileImage").Url(); <div class="col-md-4 py-1"><a title="#@player.Value("primetimeJerseyNumber") - @player.Value("playerName") - @player.Value("playerHighSchool")" href="@player.Url()"><img src="@imageUrl" class="rounded-lg" /></a></div> }
Works, if I do this... it does not:
@foreach(var player in players) { <div class="col-md-4 py-1"><a title="#@player.Value("primetimeJerseyNumber") - @player.Value("playerName") - @player.Value("playerHighSchool")" href="@player.Url()"><img src="@player.Value<MediaWithCrops>("playerProfileImage").Url()" class="rounded-lg" /></a></div> }
Hi Ckincincy
It might be bc of the qoutes (").
It might work to do
<img src="@(player.Value<MediaWithCrops>("playerProfileImage").Url())" class="rounded-lg" />
Best regards Frank
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
Get URL for MediaPicker content on custom data type
Have a data type defined with many values, one being a media picker.
This gets the data:
This mostly works:
What is not working is figuring out how to get the profile image.
Have tried many variations:
And others, what am I missing here?
Fought with this for most of a day, can't find the magic sauce. Help is appreciated.
I have it working, why did I need to make the call into two lines?
Works, if I do this... it does not:
Hi Ckincincy
It might be bc of the qoutes (").
It might work to do
Best regards Frank
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.