I'm using ldap3.
I can connect and read all attributes without any issue, but I don't know how to display the photo of the attribute thumbnailPhoto.
If I print(conn.entries[0].thumbnailPhoto)
I get a bunch of binary values like b'\xff\xd8\xff\xe0\x00\x10JFIF.....'
.
I have to display it on a bottle web page. So I have to put this value in a jpeg or png file.
How can I do that?
Asked
Active
Viewed 5,796 times
1

Gabor
- 1,409
- 1
- 14
- 24
-
Please provide more information: https://stackoverflow.com/help/how-to-ask – jwilleke Mar 25 '18 at 11:09
2 Answers
1
The easiest way is to save the raw byte value in a file and open it with a picture editor. The photo is probably a jpeg, but it can be in any format.

cannatag
- 1,528
- 11
- 17
1
Have a look at my answer at Display thumbnailPhoto from Active Directory in PHP. It's especially for PHP but the concept is the same for Python.
basically it's about either using the base64 encoded raw-data as data-stream or actually using a temporary file that is serverd (or used to determine the mime-type)

heiglandreas
- 3,803
- 1
- 17
- 23