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.6030...@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.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Python-LDAP-dev mailing list
Python-LDAP-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev

Reply via email to