Custom Images for SharePoint profile page view

Sometimes you need to tightly control profile pictures in MOSS / SharePoint 2007. An easy way to do this if your pictures have the right naming convention is as follow.

Looking at the URL of the profile we can see that the data is clearly sent “/Person.aspx?accountname=DOMAIN%5JohnDoe” In this case we are looking at the domain user JDoe aka John Doe on the domain DOMAIN.
Edit person.aspx and at about line 39 comment out “
And replace it with the following JavaScript…


< type="text/javascript">
var str1=”< propertyname="FirstName" runat="server" preview="FirstName" values="<P N='PropertyName' T='FirstName' /><P N='ControlStyle'><P N='Font' ID='1' /></P><P N='Font' R='1' /><P N='ID' ID='2' T='ctl02' /><P N='Page' ID='3' /><P N='TemplateControl' R='3' /><P N='AppRelativeTemplateSourceDirectory' R='-1' />">“;
var str2=”< propertyname="LastName" runat="server" preview="LastName" values="<P N='PropertyName' T='LastName' /><P N='ControlStyle'><P N='Font' ID='1' /></P><P N='Font' R='1' /><P N='ID' ID='2' T='ctl03' /><P N='Page' ID='3' /><P N='TemplateControl' R='3' /><P N='AppRelativeTemplateSourceDirectory' R='-1' />">“;
str1 = str1.replace(“<>“, “”);
str1 = str1.replace(“< /span>“, “”);
str2 = str2.replace(“<>“, “”);
str2 = str2.replace(“< /span>“, “”);
document.write(“< src="'http://people/FirmDirectory/FacebookPictures/" alt="'" width="'72'"> <>“);
< /script>

(In this case our images have the following naming convention FirstLast.gif.)

As usual HTML tags have been changed in the following way:
“<" is now "< ".