Class humhub\libs\ProfileImage

Inheritancehumhub\libs\ProfileImage
Subclasseshumhub\libs\ProfileBannerImage
Available since version0.5

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

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$defaultImage String Name of the default image humhub\libs\ProfileImage
$folder_images String Folder name inside the uploads directory humhub\libs\ProfileImage
$guid String Is the guid of user or space humhub\libs\ProfileImage
$height Integer Height of the Image humhub\libs\ProfileImage
$width Integer Width of the Image humhub\libs\ProfileImage

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor of Profile Image humhub\libs\ProfileImage
cropOriginal() Crops the Original Image humhub\libs\ProfileImage
delete() Deletes current profile humhub\libs\ProfileImage
getPath() Returns the Path of the Modified Profile Image humhub\libs\ProfileImage
getUrl() Returns the URl of the Modified Profile Image humhub\libs\ProfileImage
hasImage() Indicates there is a custom profile image humhub\libs\ProfileImage
setNew() Sets a new profile image by given temp file humhub\libs\ProfileImage

Property Details

$defaultImage protected property

Name of the default image

protected String $defaultImage null
$folder_images protected property

Folder name inside the uploads directory

protected String $folder_images 'profile_image'
$guid protected property

Is the guid of user or space

protected String $guid ''
$height protected property

Height of the Image

protected Integer $height 150
$width protected property

Width of the Image

protected Integer $width 150

Method Details

__construct() public method

Constructor of Profile Image

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

public void __construct ( $guid, $defaultImage 'default_user' )
$guid string
$defaultImage string
cropOriginal() public method

Crops the Original Image

public boolean cropOriginal ( $x, $y, $h, $w )
$x Int
$y Int
$h Int
$w Int
return boolean

Indicates the success

delete() public method

Deletes current profile

public void delete ( )
getPath() public method

Returns the Path of the Modified Profile Image

public String getPath ( $prefix '' )
$prefix String

For the profile image

return String

Path to the profile image

getUrl() public method

Returns the URl of the Modified Profile Image

public String getUrl ( $prefix '', $scheme false )
$prefix String

Prefix of the returned image

$scheme boolean

URL Scheme

return String

Url of the profile image

hasImage() public method

Indicates there is a custom profile image

public Boolean hasImage ( )
return Boolean

Is there a profile image

setNew() public method

Sets a new profile image by given temp file

public void setNew ( $file )
$file mixed

CUploadedFile or file path