$ldap = ldap_connect($ad_host);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); ldap_bind($ldap, $reader_rdn, $reader_pass); $res = ldap_search($ldap, $base_dn, "($uid_attrib=".$_REQUEST['uid'].")", array('jpegPhoto')); $info = ldap_get_entries($ldap, $res); $photo = $info[0]['jpegphoto'][0]; $img = imagecreatefromstring($photo); header("Content-type: image/jpeg"); imagejpeg($img,NULL,100); lsap_close(ldap);Источник: здесь