|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-10-13 14:20 UTC] venaas at cvs dot php dot net
[2013-04-10 06:26 UTC] dhiraj dot w87 at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 13:00:01 2025 UTC |
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