Avatar

class OC\Avatar\Avatar
This class gets and sets users avatars.
Source:lib/private/Avatar/Avatar.php#51
Implements:OCP\IAvatar

Properties

protected static property OC\Avatar\Avatar::$logger
Source:lib/private/Avatar/Avatar.php#54
Type:\Psr\Log\LoggerInterface

Methods

public OC\Avatar\Avatar::__construct($logger)
Source:lib/private/Avatar/Avatar.php#72
public abstract OC\Avatar\Avatar::getDisplayName()
Returns the user display name.
Source:lib/private/Avatar/Avatar.php#81
Returns:string
public OC\Avatar\Avatar::get($size=64)
Source:lib/private/Avatar/Avatar.php#102
protected OC\Avatar\Avatar::getAvatarVector($size)
{size} = 500
{fill} = hex color to fill
{letter} = Letter to display
Generate SVG avatar
Source:

lib/private/Avatar/Avatar.php#127

Parameters:
  • $size (int) The requested image size in pixel
Returns:

string

protected OC\Avatar\Avatar::generateAvatarFromSvg($size)
Generate png avatar from svg with Imagick
Source:

lib/private/Avatar/Avatar.php#142

Parameters:
  • $size (int)
Returns:

string | bool

protected OC\Avatar\Avatar::generateAvatar($userDisplayName, $size)
Generate png avatar with GD
Source:

lib/private/Avatar/Avatar.php#169

Parameters:
  • $userDisplayName (string)
  • $size (int)
Returns:

string

protected OC\Avatar\Avatar::imageTTFCenter($image, $text, $font, $size, $angle=0)
Calculate real image ttf center
Source:

lib/private/Avatar/Avatar.php#210

Parameters:
  • $image (resource)
  • $text (string) text string
  • $font (string) font path
  • $size (int) font size
  • $angle (int)
Returns:

array

public OC\Avatar\Avatar::avatarBackgroundColor($hash)
Source:

lib/private/Avatar/Avatar.php#294

Parameters:
  • $hash (string)
Returns:

\OC\Color Object containting r g b int in the range [0, 255]