Here is a simple way to add in the logged in users profile picture right before or after the users name in the SharePoint 2010 ribbon.
1.) Add the following to the top of your custom master page right before the doctype:
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
2.) Add in the following control right before the welcome text:
<SPSWC:ProfilePropertyImage PropertyName="PictureUrl" style="float: left; height: 20px;" ShowPlaceholder="true" id="PictureUrlImage" runat="server"/>
A nice feature that you can customize is if you don’t want to show a placeholder image if a users has not uploaded a custom picture you can simply change ShowPlaceholder="true" to “false”. and it will only show a picture if someone has specified a custom one in their profile.
If you want to have the image on the right simply move the control after the welcome and muiselctor controls, also remove the float:left in the picture style:
<wssuc:Welcome id="IdWelcome" runat="server" EnableViewState="false"></wssuc:Welcome>
<wssuc:MUISelector ID="IdMuiSelector" runat="server"/>
<SPSWC:ProfilePropertyImage PropertyName="PictureUrl" style="height: 20px;" ShowPlaceholder="true" id="PictureUrlImage" runat="server"/>
The 20px height is that golden number because any larger and the image will get cropped off on the bottom in IE7 and in IE8 you will start to see some separation and cropping of the ribbon when viewing the other ribbon tabs.
The inline CSS above on the control is just to keep this blog post simple, Its recommended to move that inline style into your custom CSS file.

21 comments:
Hello,
with this picture in place and the statusbar present i am trying to make the picture a link to the profile of the user currently logged in.
i managed to make the picture clickable and i can set the navigationUrl but i am looking for the link to the currentUser profile.
any thoughts?
with kind regards.
Hi,
Thanks for the post. I was wondering if this picture could be used on site pages other than the master page?
I keep getting an error saying Unknown server tag 'SPSWC:ProfilePropertyImage' despite adding the server tag prefix in the code. Any suggestions?
@ Naren,
Are you by any chance trying this on foundation rather than SharePoint Server?
This has SAVED me! Any suggestions on how to do this on the My Site pages?
Hi,
Thanks dear, I'm always getting User name and password each time I access the intranet the first time. is there any solution?
Thanks
Rob - just use http:///person.aspx
Naren - Yes you can
Sayed - add your site to your trusted sites in IE OR switch to Kerberos
Noticed that when a user is viewing someone else's profile, instead of the currently logged in user the control displays the person's profile they are viewing. Looking for a workaround now...
Hi,
How to make Picture clickable one ? any ideas ... kindly suggest.
Thanks
hello, I've done this but unfortunately the displayed picture was the default one. i.e. the one which display if the user has no picture uploaded to his profile.
Any advice?
Any replay, I'm using SP server 2010
Can this be done in Sharepoint Foundation as I seem to be getting the same problem as Naren?
You can find SOLUTION here for foundation
http://chakrib.blogspot.in/2012/04/display-user-image-or-beside-welcome.html
Many Thanks Chakri.
well, no matter how many times i try it wont show it beside Current user,
i use Sharepoint server 2010,
before welcome after welcome ...
any suggestion?
Any idea how to make this work on My Sites? I am using feature stapling to staple my custom masterpage to the My Sites but I cant seem to get the image to appear next to the Welcome Menu...
The welcome menu is visible just the image is not and I have no idea what to do about it...Anyone have similar issues in My Sites?
I have three better ways to show the user image. You can find it on my blog: http://lixuan0125.wordpress.com/2012/06/11/display-user-profile-picture-next-to-welcome-name/
Very nice info , it works in SharePoint 2013 as well just change the version to 15.0.0.0
Thanks for the article !!!
i am doing this on Office 365 site.
but issue is that image is getting fetched for first time. If i go to the 'My Profile' and return back then and only then image get displayed. How to solve this issue. I am getting User Information using JavaScript.
Great guide. I am clearly gonna use it. And maybe reblog it.
This is great......is there any way to make it work with WSS 3.0
Aparna
Post a Comment