Tool: Import Pictures for all you Profiles

Here at Tam Tam we are currently working on implementing SP2010 as our Portal and Customer Portal Platform.

We wanted to have all our Employee profiles to include pictures:

SP2010 stores Profile Pictures in the MySite Host. There is a Picture Library there called “User Photos”. Inside there is a Folder named Profile Pictures. If it is not, it just means no one has uploaded a Profile Picture yet.

Each profile picture comes in three flavours: _LThumb, _MThumb and _SThumb. SP2010 does this for you, through the Profile Property Editor for Profile Pictures.

So, with the help of Reflector, I wrote a small tool that would import all our profile pictures and update the user profiles. I created a small Forms application that would import the profile pictures, based on username.jpg pictures.

The magic hapens here, this code is by Microsoft actually, not me:

using (Bitmap bitmap = new Bitmap(num3, num4, PixelFormat.Format32bppArgb))
            {
                using (Graphics graphics = Graphics.FromImage(bitmap))
                {
                    graphics.CompositingMode = CompositingMode.SourceCopy;
                    graphics.CompositingQuality = CompositingQuality.HighQuality;
                    graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    graphics.DrawImage(original, 0, 0, num3, num4);
                    using (MemoryStream stream2 = new MemoryStream())
                    {
                        bitmap.Save(stream2, ImageFormat.Jpeg);
                        stream2.Position = 0L;
                        return folder.Files.Add(fileName, stream2, true);
                    }
                }
            }

If you want you can use the tool and the code by going here. It is a research project, not a product!

And now we have profile pictures for Tweets:

Organisational browser:

 

Advertisements

3 Responses to “Tool: Import Pictures for all you Profiles”

  1. Jeff Says:

    Are there any instructions on how to install your scripts? I cant even find an install guide on the codeplex website. Please advise. Thanks!

  2. Ikram Says:

    This code works so good and the pictures comes through instantly. Thanks.

  3. Santhosh Says:

    Will this work in MOSS 2007?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: