I'm having trouble dealing with binary data pulled from an LDAP server. Maybe the PHP LDAP functions are not 8-bit clean? It seems so unlikely I suspect I am being stupid. If I extract an array of data from the LDAP server, one piece of which is a JPEG and the rest is ASCII text, I can easily print the ASCII stuff but not the JPEG.
Are there any special tricks for handling this type of data? I am currently using ldap_get_attributes() to fetch the data and then collapsing it into a unidimensional array by saving the first value in each attribute array.
If my JPEG is $foo["image"] in my unidimensional array of LDAP result data,
and I do something like this, it doesn't work:
<?
header("Content-Type: image/jpeg");
header("Content-Disposition: inline");
echo $foo["image"];
?>
I have also tried altering $foo["jpegphoto"] with stripslashes() and stripcslashes(). Unfortunately I don't know anything about how this data is stored on the LDAP server I'm talking to.