ProfileImage
in package
ProfileImage is responsible for all profile images.
This class handles all tasks related to profile images. Will used for Space or User Profiles.
Prefixes: "" = Resized profile image "_org" = Orginal uploaded file
Tags
Table of Contents
Properties
- $container : ContentContainerActiveRecord
- $defaultImage : string
- $folder_images : string
- $guid : string
- $height : int
- $width : int
Methods
- __construct() : mixed
- Constructor of Profile Image
- cropOriginal() : bool
- Crops the Original Image
- delete() : mixed
- 1 Deletes current profile
- getAspectRatio() : float
- Get aspect ratio
- getContainer() : ContentContainerActiveRecord|string
- getPath() : string
- Returns the Path of the Modified Profile Image
- getUrl() : string
- Returns the URl of the Modified Profile Image
- hasImage() : bool
- Indicates there is a custom profile image
- height() : int
- Get height
- render() : string
- Renders this profile image
- setNew() : mixed
- Sets a new profile image by given temp file
- width() : int
- Get width
Properties
$container
protected
ContentContainerActiveRecord
$container
$defaultImage
protected
string
$defaultImage
name of the default image
$folder_images
protected
string
$folder_images
= 'profile_image'
folder name inside the uploads directory
$guid
protected
string
$guid
= ''
is the guid of user or space
$height
protected
int
$height
= 150
height of the Image
$width
protected
int
$width
= 150
width of the Image
Methods
__construct()
Constructor of Profile Image
public
__construct(string $guid[, string $defaultImage = 'default_user' ]) : mixed
UserId is optional, if not given the current user will used
Parameters
- $guid : string
- $defaultImage : string = 'default_user'
cropOriginal()
Crops the Original Image
public
cropOriginal(int $x, int $y, int $h, int $w) : bool
Parameters
- $x : int
- $y : int
- $h : int
- $w : int
Tags
Return values
bool —indicates the success
delete()
1 Deletes current profile
public
delete() : mixed
getAspectRatio()
Get aspect ratio
public
getAspectRatio() : float
Return values
floatgetContainer()
public
getContainer() : ContentContainerActiveRecord|string
Tags
Return values
ContentContainerActiveRecord|stringgetPath()
Returns the Path of the Modified Profile Image
public
getPath([string $prefix = '' ]) : string
Parameters
- $prefix : string = ''
-
for the profile image
Tags
Return values
string —Path to the profile image
getUrl()
Returns the URl of the Modified Profile Image
public
getUrl([string $prefix = '' ][, bool $scheme = false ]) : string
Parameters
- $prefix : string = ''
-
Prefix of the returned image
- $scheme : bool = false
-
URL Scheme
Tags
Return values
string —Url of the profile image
hasImage()
Indicates there is a custom profile image
public
hasImage() : bool
Tags
Return values
bool —is there a profile image
height()
Get height
public
height() : int
Return values
intrender()
Renders this profile image
public
render([int $width = 32 ][, array<string|int, mixed> $cfg = [] ]) : string
Parameters
- $width : int = 32
- $cfg : array<string|int, mixed> = []
Tags
Return values
stringsetNew()
Sets a new profile image by given temp file
public
setNew(mixed $file) : mixed
Parameters
- $file : mixed
-
CUploadedFile or file path
Tags
width()
Get width
public
width() : int