Any example to display jpegPhoto?
Michael Ströder
michael at stroeder.com
Tue Jun 9 21:37:22 CEST 2009
Zhang Huangbin wrote:
> Zhang Huangbin wrote:
>>> Not sure what you really want to display and where.
>>>
>>> How about entry['jpegPhoto'][0].encode('base64') ?
>
> Still confused what data type it stored in LDAP.
> Already base64 encoded?
Please read my e-mails more carefully.
As said in <4A2A4666.6030403 at stroeder.com> it's the raw binary JPEG
image data.
> Display entry['jpegPhoto'][0] directly, got error msg:
> ----
> 'ascii' codec can't decode byte 0x89 in position 0: ordinal not in
> range(128)
> ----
>
> How can i display it if i use 'content-type: image/jpeg' header?
Send the binary data directly. Don't try to (implicitly) convert
entry['jpegPhoto'][0] to a Unicode object. You might want to learn a bit
more about normal strings vs. Unicode objects, string coercion and how
to interpret exceptions like the one above before going any further.
Ciao, Michael.
More information about the python-ldap
mailing list