You need to sign in to do that
Don't have an account?
bensondaniel
Profile Photo
I am creating a visualforce page which will display the profile photo of the user in it.
Can someone help me reference it ?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
I am creating a visualforce page which will display the profile photo of the user in it.
Can someone help me reference it ?
Select u.SmallPhotoUrl, u.FullPhotoUrl From User u
One of those should give you the URL to the Profile Pic of the User
In markup:
<apex:page standardcontroller="user">
<apex:image value="{!User.smallphotourl}"/> <br/>
<apex:image value="{!User.fullphotourl}"/> <br/>
</apex:page>
where you speciify the user id in the query parameter for the page. Obviously, variations where you get the id from somewhere else are more likely whay you want.
Is this
<apex:image value="{$User.smallphotourl}"/> ??
moreover I am already using a custom controller...
I need this photo on that same page...
I tried my suggestion (code pasted above)
it is not working..! :(
When you will do Query to get User Profile photo by SOQL Query,FullPhotoUrl will provide
"https://c.ap1.content.force.com/profilephoto/72990000000PD3X/F."
This is sample code to retrieve profile photo url in a visual force page.
VF code:
<apex:page controller="cls_PhotoUrl">
<apex:form>
<apex:image value="{!Photolink}"/>
</apex:form>
</apex:page>
Controller code:
Public class cls_PhotoUrl
{
public string Photolink{get;set;}
Public cls_PhotoUrl()
{
User u = [Select u.SmallPhotoUrl, u.FullPhotoUrl From User u where u.id=:Userinfo.getUserid()];
Photolink = u.FullPhotoUrl;
}
}
I am making a public website using VisualForce
e.g.
<apex:image url="{!DefaultUser.FullPhotoUrl}" width="134" />
if user upload a image than image does not display on the page.
I have even try this using session. e.g.
<apex:image url="{!DefaultUser.FullPhotoUrl}?session_id={!$Api.Session_ID}&server_url={!$Api.Partner_Server_URL_140}" width="134" />
Did you ever find a solution or workaround for this? We're having the same issue - displaying a User Profile image works great when testing the VisualForce page, but on the "public" site - no luck.
I'm also trying to solve this issue currently. Did you find any solution or workaround?
In my implementation I have a "Team Bio" page which just lists the users from a particular Public Group.
Internally, the pics all show up fine, but on our Customer portal they do not. I am convinced it is a session thing.
I would rather not have to duplicate all the images as document records or static resources.
Wassup.
Finally got it.
Here it is with a custom controller embeded in a component.
Component reference:
<apex:component Controller="profile">
<apex:image id="profileImage" url="{!profileImageUrl}" />
</apex:component>
Custom controller reference:
public class profile {
public String profileImageUrl { get; set; }
List<user> lstuser;
public profile () {
lstuser = [select FullPhotoUrl from User where Id =: UserInfo.getUserId()];
profileImageUrl=lstuser[0].FullPhotoUrl;
}
}
Apex code:
<apex:pageBlock >
<apex:form >
<c:profile />
</apex:form>
</apex:pageBlock>
------------------------
Welcome,
Alex O.
Thanks for providing this answer.
Can you assist with the Test for the 'profile' class?