Bug #2507: jpegphoto & LDAP problem
| From: | jmi at softway dot fr | Date: | Wed, 13 Oct 1999 16:32:55 +0000 |
| Subject: | Bug #2507: jpegphoto & LDAP problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-11720@lists.php.net to get a copy of this message | ||
From: jmi@softway.fr
Operating system: Linux
PHP version: 3.0.12
PHP Bug Type: LDAP related
Bug description: jpegphoto & LDAP problem
I use this little snippet of code to retreive a jpeg image from the directory.
--CODE--
$sr=ldap_read($ds,"$dnpic","jpegphoto=*",array("jpegphoto"));
$info = ldap_get_entries($ds, $sr);
Header("Content-type: image/jpeg");
echo $info[0]["jpegphoto"][0];
$f = fopen("/tmp/fil.jpg","w");
fwrite($f,$info[0]["jpegphoto"][0]);
--CODE--
The file /tmp/fil.jpg will contain all bytes in the image up til the first NULL byte occurence where
it is cut off.
Using ldap_search() with appropriate params yields the same result. And I have tested to retreive
the image using LDAP command-line clients - works fine.
The image data is stored in binary format (Netscape Directory model).
If I use this command (ldapsearch is from the openldap package):
ldapsearch -B -h monza -b "ou=people,o=softway,c=fr" "uid=jmi*" jpegphoto
I retrieve the beginning of the the jpeg picture until the first null byte occurence.
This is how it's seems to work with this php3 script.
However, if I add the -L option in this ldapsearch command, I can retrieve all the jpeg file in LDIF
format.
Is there a special option to retrieve the jpegphoto data in an other format like BASE64 ?
Thanks