fixed image download

This commit is contained in:
Roland Gruber 2007-02-18 18:35:25 +00:00
parent 8b50339b57
commit 1e05c1ae9c
1 changed files with 6 additions and 4 deletions

View File

@ -177,12 +177,14 @@ class lamUserList extends lamList {
elseif ($attribute == "jpegphoto") { elseif ($attribute == "jpegphoto") {
if (sizeof($entry[$attribute][0]) < 100) { if (sizeof($entry[$attribute][0]) < 100) {
// looks like we have read broken binary data, reread photo // looks like we have read broken binary data, reread photo
$result = @ldap_search($_SESSION['ldap']->server(), $entry['dn'], $attribute . "=*"); $result = @ldap_search($_SESSION['ldap']->server(), $entry['dn'], $attribute . "=*", array($attribute));
if ($result) { if ($result) {
$tempEntry = @ldap_first_entry($_SESSION['ldap']->server(), $result); $tempEntry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
$binData = ldap_get_values_len($_SESSION['ldap']->server(), $tempEntry, $attribute); if ($tempEntry) {
if (isset($binData['count'])) unset($binData['count']); $binData = ldap_get_values_len($_SESSION['ldap']->server(), $tempEntry, $attribute);
$entry[$attribute] = $binData; if (isset($binData['count'])) unset($binData['count']);
$entry[$attribute] = $binData;
}
} }
} }
$jpeg_filename = 'jpg' . $_SESSION['ldap']->new_rand() . '.jpg'; $jpeg_filename = 'jpg' . $_SESSION['ldap']->new_rand() . '.jpg';