Implements lavatar and replace default photo avatar with generated lavatar

This commit is contained in:
Hadi Nategh 2018-08-13 11:56:05 +02:00
parent 29337d79d1
commit e1ee71873a
2 changed files with 11 additions and 2 deletions

View File

@ -2510,7 +2510,7 @@ window.egw_LAB.wait(function() {
// Enable history
$this->setup_history($content, $sel_options);
$content['photo'] = $this->photo_src($content['id'],$content['jpegphoto'],'photo',$content['etag']);
$content['photo'] = $this->photo_src($content['id'],$content['jpegphoto'],'',$content['etag']);
if ($content['private']) $content['owner'] .= 'p';
@ -3204,6 +3204,15 @@ window.egw_LAB.wait(function() {
!(($contact['files'] & Api\Contacts::FILES_BIT_PHOTO) && // new SQL in VFS
($size = filesize($url=Api\Link::vfs_path('addressbook', $contact_id, Api\Contacts::FILES_PHOTO)))))
{
if (is_array($contact))
{
echo Api\avatar::lavatar(array(
'id' => $contact['id'],
'firstname' => $contact['n_given'],
'lastname' => $contact['n_family'])
);
exit();
}
Egw::redirect(Api\Image::find('addressbook','photo'));
}
// use an etag over the image mapp

View File

@ -764,7 +764,7 @@ class Contacts extends Contacts\Storage
function photo_src($id,$jpeg,$default='',$etag=null)
{
//error_log(__METHOD__."($id, ..., etag=$etag) ". function_backtrace());
return $jpeg ? array(
return $jpeg || !$default ? array(
'menuaction' => 'addressbook.addressbook_ui.photo',
'contact_id' => $id,
)+(isset($etag) ? array(