IAvatar
This class provides avatar functionality
Tags
Table of Contents
- avatarBackgroundColor() : Color
- exists() : bool
- Check if an avatar exists for the user
- get() : bool|IImage
- get the users avatar
- getFile() : File
- Get the file of the avatar
- isCustomAvatar() : bool
- Check if the avatar of a user is a custom uploaded one
- remove() : void
- remove the users avatar
- set() : void
- sets the users avatar
- userChanged() : mixed
- Handle a changed user
Methods
avatarBackgroundColor()
public
avatarBackgroundColor(string $text) : Color
Parameters
- $text : string
Tags
Return values
Color —Object containting r g b int in the range [0, 255]
exists()
Check if an avatar exists for the user
public
exists() : bool
Tags
Return values
bool —get()
get the users avatar
public
get([int $size = 64 ]) : bool|IImage
Parameters
- $size : int = 64
-
size in px of the avatar, avatars are square, defaults to 64, -1 can be used to not scale the image
Tags
Return values
bool|IImage —containing the avatar or false if there's no image
getFile()
Get the file of the avatar
public
getFile(int $size) : File
Parameters
- $size : int
-
-1 can be used to not scale the image
Tags
Return values
File —isCustomAvatar()
Check if the avatar of a user is a custom uploaded one
public
isCustomAvatar() : bool
Tags
Return values
bool —remove()
remove the users avatar
public
remove() : void
Tags
set()
sets the users avatar
public
set(IImage|resource|string $data) : void
Parameters
- $data : IImage|resource|string
-
An image object, imagedata or path to set a new avatar
Tags
userChanged()
Handle a changed user
public
userChanged(mixed $feature, mixed $oldValue, mixed $newValue) : mixed
Parameters
- $feature : mixed
- $oldValue : mixed
- $newValue : mixed