I made sure there is an image that's already picked but the variable photo is still being left out as a null. If I remove the <IPublishedContent> the variable gets the umb value.
The problem you are having is that you are not retreiving the member correctly in order to get at the image
var currentEntreprise = await _memberManager.GetCurrentMemberAsync();
returns a MemberIdentity, in order to access the image property for that member you need an IpublishedContent model, you can convert the memberidenty to a published content by calling
var member = _MemberManager.AsPublishedMember(entreprise);
now you can get the image and render it
var typedMediaPickerSingle = member.Value<MediaWithCrops>("logo");
<img src="@typedMediaPickerSingle.Url() " alt="" />
I don't think there is anything explicitly stated for a custom property on the member, but if you mark it as answered someone may find the post helpful when looking :)
Rendering image from member's property media picker
Hi there!
After setting up coustom routing for members profile pages I want to display all the data they have as member properties.
Some of those properties are Images selected from Media Pickers.
memberProfile
is fromUmbraco.Core.Models.Member
.I made sure there is an image that's already picked but the variable
photo
is still being left out as a null. If I remove the<IPublishedContent>
the variable gets the umb value.How could I solve this issue?
Hi ggesheva, I am not sure what exactly is the issue but here are 3 things to try.
First in case you are using a the MediaPicker2 with Multiple enabled, try something like this
and if its the new MediaPicker3 try something like this
Multiple enable:
Multiple disabled:
Hello, I have the same issue for my project on Umbraco 10. I'm trying to render the Media Picker 3 image on a page but it's being left out as a null.
Did you solved this?
should be something like
Did you get this resolved? I have the same issue. The value returns null if I try to cast it. This is the raw value:
What data type is this?
Hi Alec & Charles,
The problem you are having is that you are not retreiving the member correctly in order to get at the image
returns a MemberIdentity, in order to access the image property for that member you need an IpublishedContent model, you can convert the memberidenty to a published content by calling
now you can get the image and render it
Hopefully that should help.
This is perfect thank you!
Is this documented somewhere? I did try to find a solution in the Umbraco docs but I definitely didn't find anything so helpful as this.
I don't think there is anything explicitly stated for a custom property on the member, but if you mark it as answered someone may find the post helpful when looking :)
Would if I could but I'm not OP.
is working on a reply...