Question
Can anyone please tell me how do I display Jpeg Image from open ldap server into the browser. I have the following fields
dn: cn=Vamsi Bodepudi, ou=jetsupport, o=companies
o: jetsupport
cn: Vamsi Bodepudi
objectclass: top
objectclass: person
objectclass: organizationalPerson
objectclass: inetOrgPerson
sn: Bodepudi
mail: Vamsi.Bodepudi@modernjet.co.uk
ou: IT
title: IT Analyst
jpegPhoto:<file:///home/vkb/encoded
I have encoded the image into base64 using a program called base64. the information in the file encoded has base64 coded data. But I don't know how to pull in the information into LDAP plugin. I tried something like this.
=%LDAP{host="abc.modernjet.co.uk" base="ou=jetsupport,o=companies" filter="cn=*" format="|$cn | $mail | $ou | $telephoneNumber | $title | $jpegPhoto |" header="| *Full Name* | *Email Address* | *Department* | *Phone* | *Title* | *Photo* |"}% =
Which brings in all the fields into the table but the jpegPhoto shows binary information. Th HTML source code for the page doesn't seem to have the correct tags to display the jpeg image. PL help!
- TWiki version:Wiki tool version is 13 Jun 2002
- Perl version: v5.8.0 built for i686-linux
- Web server & version: Apache/1.3.27 (Unix) PHP/4.3.1 mod_perl/1.27 mod_ssl/2.8.12 OpenSSL/0.9.7a
- Server OS: 2.4.18-6mdkenterprise #1 SMP Fri Mar 15 02:28:20 CET 2002 i686
- Web browser & version: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
- Client OS: WinXP Home addition
--
VamsiKrishna - 06 Jun 2003
Answer
This will require some programming - basically you'll need to write the binary JPEG info from $jpegPhoto into a temporary file that is addressable within your webspace (perhaps in
twiki/pub
), and generate suitable HTML to the URL of this .jpg file. It might be feasible to name the file based on the LDAP DN, effectively caching the file, but then you'd have to make sure to update it if the photo changed. This could perhaps be done as an extension to the LDAP plugin.
--
RichardDonkin - 06 Jun 2003
Thank you richard for your answer. Perhaps I need to decode the image before writing it into a temporary file. I did it in a dirty way which may not be a good solution. I changed my ldif file for something like this.
.
.
jpegPhoto: http://myurl/staffphoto/vam.jpeg
and copied the image into that location . The LDap plugin is declared something like this.
%LDAP{host="mail.modernjet.co.uk" base="ou=jetsupport,o=companies" filter="cn=*" format="|$cn | $mail | $ou | $telephoneNumber | $title |<br> $jpegPhoto <br>| $description |" header="| *Full Name* | *Email Address* | *Department* | *Phone* | *Title* | *Photo* | *Alternate Point of Contact* |"}%
Which did put a img tag before the picture. it works fine! THx again for ur answer .
vamsi
--
VamsiKrishna - 06 Jun 2003