I have a photo outside the gallery that displays the user's current photo or his initials if he does not have a profile photo (I use an external website UI AVATARS).
Everything works fine and the code looks like this:
If(
IsBlank(UżytkownicyusługiOffice365.UserPhotoV2(User().Email));
"https://ui-avatars.com/api/?name=" & Left(User().FullName; 1) & "+" & Mid(User().FullName; Find(" "; User().FullName) + 1; 1) & "&background=0075D4&color=FFFFFF";
UżytkownicyusługiOffice365.UserPhotoV2(User().Email)
)
I have a problem with a similar setting but in the gallery. I want to set it to display photos of the author of the entry from the SharePoint list, and if the author does not have a photo, display his initials.
The code looks like this but if someone does not have a profile photo, the initials are only shown for a second after refreshing the gallery and the image disappears.
If(
!IsBlank(ThisItem.Author.Email);
UżytkownicyusługiOffice365.UserPhotoV2(ThisItem.Author.Email);
"https://ui-avatars.com/api/?name=" & Left(ThisItem.Author.DisplayName; 1) & "+" & Mid(ThisItem.Author.DisplayName; Find(" "; ThisItem.Author.DisplayName) + 1; 1) & "&background=FFFFFF&color=0075D4"
)
I also tried to use an uploaded photo ("TESTIMAGE") to display it if someone does not have a profile photo. But there is the same problem. If someone has a profile photo, it is displayed, but if they don't, a replacement photo appears for a second after refreshing the gallery and disappears.
The code looks like this:
If(
!IsBlank(ThisItem.Author.Email);
UżytkownicyusługiOffice365.UserPhotoV2(ThisItem.Author.Email);
TESTIMAGE
)
And this code has the same problem:
If(
!IsBlank(ThisItem.Author.Email);
If(
IsBlank(UżytkownicyusługiOffice365.UserPhotoV2(ThisItem.Author.Email));
TESTIMAGE;
UżytkownicyusługiOffice365.UserPhotoV2(ThisItem.Author.Email)
);
TESTIMAGE
)
Unfortunately, my knowledge ends here and I don't know how to solve this problem to display it in one photo control.

Report
All responses (
Answers (