Monday, March 27, 2006

Ever wondered how to increase the size of the My Site Photo?

I had a customer the other week that wanted everyone's My Site photo to appear a little larger (so that vision impaired people could see it easier). Out of the box, SharePoint sets the maximum photo size to 100 x 100. If a photo is only 50 x 50, then it still gets rendered at 50 x 50 because SharePoint does not stretch an image to be larger than its original size. The average size of the photos that my customer was uploading to the Staff Image library was 300 x 200. SharePoint would shrink this image to be around the 100 x 66 resolution. To fix it, I modified public.aspx, which exists in the My Site template (C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\SPSMSITE). I changed the text from:

<table cellspacing=0 cellpadding=0 style="table-layout: fixed" width="100" id="tablePictureUrl">
<tr id="PictureUrlImage_TR" height="100"><td id="ProfileViewer_ValuePictureUrl" valign=top align=right>
<SPSWC:ProfilePropertyImage PropertyName="PictureUrl" ResizeToFit="100" ShowPlaceholder="true" id="PictureUrlImage" runat="server" />


<table cellspacing=0 cellpadding=0 style="table-layout: fixed" width="300" id="tablePictureUrl">
<tr id="PictureUrlImage_TR" height="300"><td id="ProfileViewer_ValuePictureUrl" valign=top align=right>
<SPSWC:ProfilePropertyImage PropertyName="PictureUrl" ResizeToFit="300" ShowPlaceholder="true" id="PictureUrlImage" runat="server" />

Quite simple really, changing '100' to '300'.

1 comment:

Dennis said...

Thank you!

One might have thought that removing the ResizeToFit attribute simple disabled resizing, but nooo.. Sharepoint decides that all pictures must be resized to 100px.

Seems like ugly workaround to have to set the ResizeToFit attribute to a value higher than any image width you can possible imagine to "disable" resizing.

Anyway, it solved my problem :)