rename/move Api\avatar::lavatar() to Api\Contacts\Lavatar::generate() to be in line with our CS

This commit is contained in:
ralf 2023-01-25 12:27:26 +01:00
parent 6ef78c9591
commit 09ceed3ba2
3 changed files with 8 additions and 9 deletions

View File

@ -34,7 +34,7 @@ function send_image()
header('Content-type: image/jpeg'); header('Content-type: image/jpeg');
header('Etag: '.md5(json_encode($params))); header('Etag: '.md5(json_encode($params)));
if (($image = Api\avatar::lavatar($params)) !== false) if (($image = Api\Contacts\Lavatar::generate($params)) !== false)
{ {
echo $image; echo $image;
} }

View File

@ -2732,7 +2732,7 @@ class Contacts extends Contacts\Storage
if(is_array($contact)) if(is_array($contact))
{ {
header('Content-type: image/jpeg'); header('Content-type: image/jpeg');
$contact['jpegphoto'] = \EGroupware\Api\avatar::lavatar(array( $contact['jpegphoto'] = Contacts\Lavatar::generate(array(
'id' => $contact['id'], 'id' => $contact['id'],
'firstname' => $contact['n_given'], 'firstname' => $contact['n_given'],
'lastname' => $contact['n_family']) 'lastname' => $contact['n_family'])

View File

@ -7,19 +7,18 @@
* @package api * @package api
* @subpackage avatar * @subpackage avatar
* @author Hadi Nategh <hn@egroupware.de> * @author Hadi Nategh <hn@egroupware.de>
* @version $Id$
*/ */
namespace EGroupware\Api; namespace EGroupware\Api\Contacts;
/** /**
* Creating letter avatar * Creating letter avatar
* *
* lavatar class designed for creating avatar image from given * Lavatar class designed for creating avatar image from given
* user firstname.lastname and outputs them as in image consist of * user firstname.lastname and outputs them as in image consist of
* first letter of the firstname plus first letter of the lastname. * first letter of the firstname plus first letter of the lastname.
*/ */
class avatar class Lavatar
{ {
// background colors // background colors
private static $BG_COLORS = array( private static $BG_COLORS = array(
@ -67,7 +66,7 @@ class avatar
* ) * )
* @param int $_size = 128 image size, default size is 128 * @param int $_size = 128 image size, default size is 128
*/ */
public static function lavatar ($_content = null, $_color = null, $_size = 128) public static function generate($_content = null, $_color = null, $_size = 128)
{ {
// firstname // firstname
$firstname = isset($_content['firstname'])? $_content['firstname'] : ''; $firstname = isset($_content['firstname'])? $_content['firstname'] : '';