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:

 

,

  1. No comments yet.
(will not be published)