Introduction:

In SharePoint 2010, the product team has done an excellent job giving some love to the mySite features, User Profiles, and using this information to integrate throughout SharePoint in order to promote some of the social features that they’ve been busy integrating into the new version.  They’ve also given a nod to some of the more corporate concerns for large scale implementation by allowing better governance so that administrators can more easily lock down or modify the profiles based on what company policies might dictate, providing administrators with an easier way to manage these photos by storing them in a central location.

The SharePoint 2010 profile picture story:

SharePoint 2010 maintains three differently sized thumbnails of the profile pictures to be used in different contexts in the product. Out of box, we use the large (144×144 px) thumbnail on the profile page contact card, the medium (96×96 px) thumbnail on the people search results page and the small (32×32 px) thumbnail on various web parts and controls displaying people data like the Newsfeed, Colleagues, In Common With You, Note Board and many others.

When a user uploads his profile picture using the photo upload UI on the “Edit Profile” page, SharePoint resizes the uploaded image to create 3 thumbnails of above mentioned sizes. Images are not cropped, just resized in order to maintain the original aspect ratio, so that the largest dimension matches the target thumbnail dimension. If the original image is smaller than the target size, the small image becomes the thumbnail instead of stretching it to meet the target. Here are some examples:

Original

Large

Medium

Small

200×100

144×72

96×48

32×16

40×40

40×40

40×40

32×32

 

All the photo thumbnails are stored in a folder named “Profile Pictures” under a Picture Library called “User Photos” under the MySiteHost site collection. Thus, we now have a centralized photo store holding the profile images for every user.  This makes it very easy for admins responsible for picture “appropriateness” to quickly scan through the library for any offensive materials.

The following naming convention exists for the thumbnail files:

 

Thumbnail

Image File Name

Size

Large

domain_username_LThumb.jpg

144×144

Medium

domain_username

96×96

Small

domain_username_SThumb.jpg

32×32

The full URL of the medium thumbnail (like, “ http://<mysitehost>/User Photos/Profile Pictures/<domain>_<username>_MThumb.jpg”) is stored in the user profile database.

SharePoint 2010 expects all the 3 thumbnails to be stored at the same location and follow the above file naming convention. Depending upon the context where the photo is rendered, SharePoint decides what thumbnail size to use and generates that URL from the _MThumb URL.

 

What does this mean for you?

As we’ve seen, there is some fairly substantial change in how the profile photos work in 2010. Let’s discuss how this affects you and how to make some common scenarios work:

Upgrading from 2007:

In 2007, we did not have the 3 differently sized thumbnails and the picture URLs in the 2007 profile database did not follow the new naming convention. If you simply use the data from the 2007 database, SharePoint UI will use the same picture URL in every context because we wouldn’t know how to pick the correct thumbnail size. This way we will possibly render a big image in an area meant for a smaller image and end-up with a broken page layout. So, we need to migrate the data from 2007 database to the new 2010-style format. We provide a powershell cmdlet to be run after upgrade to achieve this. From the SharePoint Management console, run:

Update-SPProfilePhotoStore -MySiteHostLocation http://<my site host URL>

This cmdlet would iterate over each user in the profile database, download their existing profile picture, create 3 correctly sized thumbnails from it and save them with proper names under the My Site Host “User Photos” picture library. On successful thumbnail creation, it will update the picture URL in the profile DB to the URL of the medium sized thumbnail.

The cmdlet updates the profile database, so it needs to be run from an account with the following permissions:

  1. Connection permission to the User Profile Application on the Services farm. You can check this by going to Central Admin on the Services farm, navigating to the “Manage Service Applications” page, selecting the “User Profile Application” from the list, and then clicking the “Permissions” button in the UI. Only the accounts listed in there have permission to run UserProfile OM code.

  2. “Manage Profiles” rights on the User Profile Application. Click on the “Administrators” button after selecting the “User Profile Application” and check the “Manage Profiles” check box.

Troubleshooting the cmdlet:

In case of any error in processing a given user’s picture (like the picture URL is invalid or unavailable), the cmdlet will skip the user and continue processing the remaining users. To capture a log of all errors and successes, you can turn on verbose and save the cmdlet output using Start-Transcript. Re-running the cmdlet will help fixing most cases, like, if a bunch of pictures were unavailable due to some network problem. The cmdlet skips picture URLs that follows the 2010 naming convention (that is, end in _MThumb), so re-running will only try to process the failed users.

Managing the photo store yourself:

Many companies want to create their own customized experience for photo upload and storage. If you are doing this, you should make sure to be compatible with the 2010 photo usage mechanism. This mainly boils down to following these rules:

  1. Create three thumbnail image files of the standard sizes (larger dimension = 32, 96 and 144). There’s no standard SharePoint OM/web service to create image thumbnails – you have to use your own resize mechanism to create them, you can also ask the user to upload 3 different images if you choose to.

  2. Name the image files following the SP 2010 naming convention (large ending in _LThumb, medium ending in _MThumb and small ending in _SThumb).

  3. Store all the 3 thumbnail images at the same location (because SharePoint will try to generate URLs for the other two thumbnails from the medium thumbnail)

  4. Use our OM to set the full URL of the medium (_MThumb) thumbnail as the PictureURL profile property for the user.

As you can see, Microsoft has put a lot of effort in increasing the social features of SharePoint 2010, with an eye towards making the integration of people and content more seamless to the user experience.  Very nice!