HumHub Documentation (unofficial)

ProfileBannerImage extends ProfileImage
in package

ProfileBannerImage is responsible for the profile banner 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
since
0.5
author

Luke

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

$defaultImage

protected string $defaultImage

name of the default image

$folder_images

protected string $folder_images = 'profile_image/banner'

folder name inside the uploads directory

$guid

protected string $guid = ''

is the guid of user or space

Methods

__construct()

Constructor of Profile Image

public __construct(string $guid[, string $defaultImage = 'default_banner' ]) : mixed

UserId is optional, if not given the current user will used

Parameters
$guid : string
$defaultImage : string = 'default_banner'

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
throws
Exception
Return values
bool

indicates the success

delete()

1 Deletes current profile

public delete() : mixed

getAspectRatio()

Get aspect ratio

public getAspectRatio() : float
Return values
float

getPath()

Returns the Path of the Modified Profile Image

public getPath([string $prefix = '' ]) : string
Parameters
$prefix : string = ''

for the profile image

Tags
throws
Exception
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
throws
InvalidConfigException
throws
Exception
Return values
string

Url of the profile image

hasImage()

Indicates there is a custom profile image

public hasImage() : bool
Tags
throws
Exception
Return values
bool

is there a profile image

height()

Get height

public height() : int
Return values
int

render()

Renders this profile image

public render([mixed $width = 32 ][, mixed $cfg = [] ]) : string
Parameters
$width : mixed = 32
$cfg : mixed = []
Tags
inheritDoc
Return values
string

width()

Get width

public width() : int
Return values
int

        
On this page

Search results