Re: Any example to display jpegPhoto?

2009-06-09 Thread Zhang Huangbin
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?

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?

-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL, CentOS,
  Debian, Ubuntu:
+ Homepage: http://code.google.com/p/iredmail/
+ Forum: http://www.iredmail.org/forum/

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: Any example to display jpegPhoto?

2009-06-09 Thread Zhang Huangbin
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?
>
> 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?
>

Forget to say, it works in non-IE browsers like this:




-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL, CentOS,
  Debian, Ubuntu:
+ Homepage: http://code.google.com/p/iredmail/
+ Forum: http://www.iredmail.org/forum/


--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: Any example to display jpegPhoto?

2009-06-09 Thread Ryan Lovett
On Tue, Jun 09, 2009 at 05:14:33PM +0800, Zhang Huangbin wrote:
> > How can i display it if i use 'content-type: image/jpeg' header?
> 
> Forget to say, it works in non-IE browsers like this:
> 
> 
> 

You would have a tag such as  where
jpegphoto.cgi is a CGI script that outputs "Content-type: image/jpeg"
followed by the JPEG data.

But that is an HTTP topic so you should probably consult a Python/CGI
resource.

Ryan

--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: Any example to display jpegPhoto?

2009-06-09 Thread Michael Ströder
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 <[email protected]> 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev


Re: Any example to display jpegPhoto?

2009-06-09 Thread Zhang Huangbin
Ryan Lovett wrote:
> You would have a tag such as  where
> jpegphoto.cgi is a CGI script that outputs "Content-type: image/jpeg"
> followed by the JPEG data.
>
> But that is an HTTP topic so you should probably consult a Python/CGI
> resource.

Solved, thanks all :)

I use webpy framework, solved just like Ryan Lovett said.

Related thread:
http://groups.google.com/group/webpy/t/9f7fdff1c75f7e93

-- 
Best regards.

Zhang Huangbin

- Open Source Mail Server Solution for RHEL, CentOS,
  Debian, Ubuntu:
+ Homepage: http://code.google.com/p/iredmail/
+ Forum: http://www.iredmail.org/forum/


--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/python-ldap-dev