Bug #4467: putting image into directory
| From: | edu at weisgerber-online dot de | Date: | Tue, 16 May 2000 09:26:37 +0000 |
| Subject: | Bug #4467: putting image into directory | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-18831@lists.php.net to get a copy of this message | ||
From: edu@weisgerber-online.de
Operating system: Linux 2.2.14 (redhat 6.x)
PHP version: 3.0.16
PHP Bug Type: LDAP related
Bug description: putting image into directory
Hi!
Just tried to put an image into LDAP directory.
---code---
<?
$con=ldap_connect("server",389);
$bind=ldap_bind($con);
$fp=fopen("/path/file.jpg","r");
$image=fread($fp,filesize("/path/file.jpg"));
fclose($fp);
$entry[jpegPhoto]=base64_encode($image);
$r=ldap_modify($con,"cn=someone,o=bla,c=de",$entry);
c=ldap_close($con);
?>
---/code---
This one produces a new (or modified) entry of type jpegPhoto in the directory, but Netscape(4.7)
LDAP-client can't read the image.
I use OpenLDAP on the server. an "ldif -b jpegPhoto \ <file.jpg >testldif" produces
a base64-encoded image. When i insert this image into directory, everything is OK and Netscape
displays the right thing. A quick look at the page source results: ldif and base64_encode() produce
different code. Question is: why? and: how ca i insert a jpeg into LDAP using php3?
Package vesions:
Apache 1.3.9
php3 3.0.16 built through DSO with: LDAP,IMAP,GD,MySQL,Postgres,Informix,PDFLib,CLibPDF,
Calendar,XML (all dynamic loading) (mail me for SRPM)
OpenLDAP 1.2.9 (as of RH 6.2)
RedHat Linux 6.2 (Kernel 2.2.14)