I'm trying to make a simple uploading application in Visual Basic.Net. I have most if it working... I can choose a user, I can select part of a photo, and I can save that to AD. I can retrieve that data out of the thumbnailPhoto attribute and display that picture back into VB.net. I can even use it as embedded data in PHP, but for some reason it's not displaying in Outlook 2010. Anybody have an brilliant ideas? Here's some relevant code (note: this is partial code, not the whole app):
-------------------- Saving to AD in VB.net -------------------------
Dim myUser As New DirectoryServices.DirectoryEntry("LDAP://" & userDN)
Dim stream As New IO.MemoryStream
Dim img As Image
Dim ptr As IntPtr
' Clear any existing photo
myUser.Properties("thumbnailPhoto").Clear()
' Make sure our size is 96x96
img = picPreview.Image.GetThumbnailImage(96, 96, thumbnail_abort, ptr)
' Convert the img to a byte array for storage in AD
img.Save(stream, Imaging.ImageFormat.Jpeg)
Dim b(stream.Length) As Byte
stream.Position = 0
stream.Read(b, 0, stream.Length)
' Store the image
myUser.Properties("thumbnailPhoto").Add(b)
myUser.CommitChanges()
------------ Retrieving from AD in VB.net -------------------
picOriginal.Image = Nothing
Dim myUser As New System.DirectoryServices.DirectoryEntry("LDAP://" & userDN)
Dim b() As Byte
b = myUser.Properties("thumbnailPhoto").Value
If b IsNot Nothing Then
picPreview.Image = Image.FromStream(New IO.MemoryStream(b))
End If
--------------- Using as a data URL in PHP --------------------
[[ $u is populated from the ldap_get_entries() function ]]
<img style='float:left; padding-right:5px;' src='data:image/jpeg;base64,".base64_encode($u['thumbnailphoto'][0])."'>
------------------------------------------------
As mentioned above, both of the retrieval functions display the thumbnailPhoto as expected, but it's still not showing up in Outlook. I double checked the schema change mentioned above and I know for sure the PHP code is using data from the Global Catalog.