UserAvatar

class OC\Avatar\UserAvatar
This class represents a registered user’s avatar.
Source:lib/private/Avatar/UserAvatar.php#47
Parent:OC\Avatar\Avatar

Properties

Methods

public OC\Avatar\UserAvatar::__construct($folder, $l, $user, $logger, $config)
UserAvatar constructor.
Source:

lib/private/Avatar/UserAvatar.php#69

Parameters:
public OC\Avatar\UserAvatar::exists()
Check if an avatar exists for the user
Source:lib/private/Avatar/UserAvatar.php#87
Returns:bool
public OC\Avatar\UserAvatar::set($data)
Sets the users avatar.
Source:

lib/private/Avatar/UserAvatar.php#100

Parameters:
  • $data (OCP\IImage | resource | string) An image object, imagedata or path to set a new avatar
Throws:

\Exception if the provided file is not a jpg or png image

Throws:

\Exception if the provided image is not valid

Throws:

\OC\NotSquareException if the image is not square

Throws:

\Exception if the provided file is not a jpg or png image

Throws:

\Exception if the provided image is not valid

Throws:

\OC\NotSquareException if the image is not square

Throws:

\Exception if the provided file is not a jpg or png image

Throws:

\Exception if the provided image is not valid

Throws:

\OC\NotSquareException if the image is not square

Returns:

void

public OC\Avatar\UserAvatar::remove($silent=false)
Removes the users avatar.
Source:lib/private/Avatar/UserAvatar.php#202
Returns:void
Throws:\OCP\Files\NotPermittedException
Throws:\OCP\PreConditionNotMetException
Throws:\OCP\Files\NotPermittedException
Throws:\OCP\PreConditionNotMetException
public OC\Avatar\UserAvatar::getFile($size)
Returns the avatar for an user.
If there is no avatar file yet, one is generated.
Source:

lib/private/Avatar/UserAvatar.php#243

Parameters:
  • $size (int)
Returns:

\OCP\Files\SimpleFS\ISimpleFile

Throws:

\OCP\Files\NotFoundException

Throws:

\OCP\Files\NotPermittedException

Throws:

\OCP\PreConditionNotMetException

Throws:

\OCP\Files\NotFoundException

Throws:

\OCP\Files\NotPermittedException

Throws:

\OCP\PreConditionNotMetException

Throws:

\OCP\Files\NotFoundException

Throws:

\OCP\Files\NotPermittedException

Throws:

\OCP\PreConditionNotMetException

public OC\Avatar\UserAvatar::getDisplayName()
Returns the user display name.
Source:lib/private/Avatar/UserAvatar.php#308
Returns:string
public OC\Avatar\UserAvatar::userChanged($feature, $oldValue, $newValue)
Handles user changes.
Source:

lib/private/Avatar/UserAvatar.php#321

Parameters:
  • $feature (string) The changed feature
  • $oldValue (mixed) The previous value
  • $newValue (mixed) The new value
Throws:

\OCP\Files\NotPermittedException

Throws:

\OCP\PreConditionNotMetException

Throws:

\OCP\Files\NotPermittedException

Throws:

\OCP\PreConditionNotMetException

public OC\Avatar\UserAvatar::isCustomAvatar()
Check if the avatar of a user is a custom uploaded one
Source:lib/private/Avatar/UserAvatar.php#335
Returns:bool