Added support for LDAP user photo profile

This commit is contained in:
Frederic Guillot
2016-05-07 12:59:35 -04:00
parent 94989663ec
commit 300dabe6b4
19 changed files with 377 additions and 13 deletions

View File

@@ -75,20 +75,20 @@ class AvatarFile extends Base
}
/**
* Upload avatar image
* Upload avatar image file
*
* @access public
* @param integer $user_id
* @param array $file
* @return boolean
*/
public function uploadFile($user_id, array $file)
public function uploadImageFile($user_id, array $file)
{
try {
if ($file['error'] == UPLOAD_ERR_OK && $file['size'] > 0) {
$destination_filename = $this->generatePath($user_id, $file['name']);
$this->objectStorage->moveUploadedFile($file['tmp_name'], $destination_filename);
$this->create($user_id, $destination_filename);
$destinationFilename = $this->generatePath($user_id, $file['name']);
$this->objectStorage->moveUploadedFile($file['tmp_name'], $destinationFilename);
$this->create($user_id, $destinationFilename);
} else {
throw new Exception('File not uploaded: '.var_export($file['error'], true));
}
@@ -101,6 +101,28 @@ class AvatarFile extends Base
return true;
}
/**
* Upload avatar image content
*
* @access public
* @param integer $user_id
* @param string $blob
* @return boolean
*/
public function uploadImageContent($user_id, &$blob)
{
try {
$destinationFilename = $this->generatePath($user_id, 'imageContent');
$this->objectStorage->put($destinationFilename, $blob);
$this->create($user_id, $destinationFilename);
} catch (Exception $e) {
$this->logger->error($e->getMessage());
return false;
}
return true;
}
/**
* Generate the path for a new filename
*