PHP Class BxAvaModule, dolphin.pro

This module allow user to crop avatar image from any photo. This is default module and Dolphin can not work properly without this module. 'Avatar' field in Profiles table is used to store current user avatar id. Avatar id is used to store avatar image, so it is easy to get avarat image if you know avatar id. You can get avatar image directly, using defines in include.php file. Refer to include.php file for all defines descriptions. Example of using this module to get avatar images: include_once (BX_DIRECTORY_PATH_MODULES . 'boonex/avatar/include.php') echo BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . BX_AVA_EXT; // avatar image echo BX_AVA_URL_USER_AVATARS . $aProfile['Avatar'] . 'i'. BX_AVA_EXT; // avatar icon Profile's Wall: 'add avatar' and 'change avatar' events are displayed on profile's wall Spy: no spy activity Memberships/ACL: avatar upload - BX_AVATAR_UPLOAD avatar edit any - BX_AVATAR_EDIT_ANY avatar delete any - BX_AVATAR_DELETE_ANY Service methods: Set image for cropping.
See also: BxAvaModule::serviceSetImageForCropping BxDolService::call('avatar', 'set_image_for_cropping', array($iProfileId, $sOrigPath)); Crop image html
See also: BxAvaModule::serviceCropTool BxDolService::call('avatar', 'crop_tool', array($aParams)); Delete all profile's avatars
See also: BxAvaModule::serviceDeleteProfileAvatars BxDolService::call('avatar', 'delete_profile_avatars', array($iProfileId)); After join redirection
See also: BxAvaModule::serviceJoin BxDolService::call('avatar', 'join', array($iMemID, $sStatusText)); Site avatars html
See also: BxAvaModule::serviceGetSiteAvatars BxDolService::call('avatar', 'get_site_avatars', array($iPage)); My avatars html
See also: BxAvaModule::serviceGetMyAvatars BxDolService::call('avatar', 'get_my_avatars', array($iProfileId)); make avatar from particular image, also it makes the image square
See also: BxAvaModule::serviceMakeAvatarFromImage BxDolService::call ('avatar', 'make_avatar_from_image', array ('/tmp/abc.jpg')); make avatar from image url, also it makes the image square
See also: BxAvaModule::serviceMakeAvatarFromImageUrl BxDolService::call ('avatar', 'make_avatar_from_image_url', array ('http://abc.com/123.jpg')); Get image from photos module and make avbatar from it, also it makes it square
See also: BxAvaModule::serviceMakeAvatarFromSharedPhotoAuto BxDolService::call ('avatar', 'make_avatar_from_shared_photo_auto', array (80)); Alerts: Alerts type/unit - 'bx_avatar' The following alerts are rised add - new avatar is added $iObjectId - avatar id $iSenderId - avatar's owner change - avatar was changed $iObjectId - avatar id $iSenderId - avatar's owner delete - avatar was deleted $iObjectId - avatar id $iSenderId - avatar's owner
Inheritance: extends BxDolModule
显示文件 Open project: boonex/dolphin.pro

Public Properties

Property Type Description
$_aAllowedExt
$_iProfileId

Public Methods

Method Description
__construct ( &$aModule )
_addAvatar ( $sFullPath, $isMove = false, $isUpdateProfile = true )
_cropAvatar ( )
_defineActions ( )
_makeAvatarFromSharedPhoto ( $iSharedPhotoId )
_removeAvatar ( $iProfileId, $iAvatar ) ================================== other function
_resizeImage ( $sImageSrc, $sImageDst, $iWidth, $iHeight, $bSquareResize = false, $bJpegOutput = true )
_setAvatar ( $iProfileId, $sImg, $isSetAvatarForCouple = false )
_uploadImage ( $iProfileId )
actionAdministration ( )
actionGetSiteAvatars ( $iPage )
actionHome ( )
actionMemberThumb ( $iProfileId )
actionRemoveAvatar ( $iProfileId, $sImg )
actionSetAvatar ( $iProfileId, $sImg )
actionSetAvatarCouple ( $iProfileId, $sImg )
actionSetSiteAvatar ( $sImg )
isAdmin ( )
isAllowedAdd ( $isPerformAction = false ) ================================== permissions
isAllowedDelete ( &$aDataEntry, $isPerformAction = false )
isAllowedEdit ( $aDataEntry, $isPerformAction = false )
onEventChanged ( $iProfileId, $iEntryId, $iCoupleProfileId, $isTryToSuspend = true )
onEventCreate ( $iEntryId ) ================================== events
onEventDeleted ( $iEntryId, $aDataEntry = [] )
serviceCropTool ( $aParams ) Returns crop image html, it consists of image for cropping, cropping preview and descriptions
serviceDeleteProfileAvatars ( $iProfileId ) : true Delete all profile's avatars
serviceGetMyAvatars ( $iProfileId ) : html My avatars html
serviceGetSiteAvatars ( $iPage ) : html Site avatars html
serviceGetWallData ( ) Register 'add avatar' and 'change avatar' events for wall
serviceGetWallPost ( $aEvent ) : html Html to display on profile wall, when user uploads new avatar
serviceJoin ( $iMemID, $sStatusText ) : false After join redirection This serice automatically log in joined user and redirects him to avatar copping page
serviceMakeAvatarFromImage ( $sImg ) : true make avatar from particular image, also it makes it square
serviceMakeAvatarFromImageUrl ( $sImgUrl ) : true make avatar from image url, also it makes it square
serviceMakeAvatarFromSharedPhotoAuto ( $iSharedPhotoId ) : true get image from photos module and make avatar from it also it makes it square
serviceManageAvatars ( $iProfileId, $isAddJsCss = false )
serviceSetImageForCropping ( $iProfileId, $sOrigPath ) : true Set image for cropping.

Method Details

__construct() public method

public __construct ( &$aModule )

_addAvatar() public method

public _addAvatar ( $sFullPath, $isMove = false, $isUpdateProfile = true )

_cropAvatar() public method

public _cropAvatar ( )

_defineActions() public method

public _defineActions ( )

_makeAvatarFromSharedPhoto() public method

public _makeAvatarFromSharedPhoto ( $iSharedPhotoId )

_removeAvatar() public method

================================== other function
public _removeAvatar ( $iProfileId, $iAvatar )

_resizeImage() public method

public _resizeImage ( $sImageSrc, $sImageDst, $iWidth, $iHeight, $bSquareResize = false, $bJpegOutput = true )

_setAvatar() public method

public _setAvatar ( $iProfileId, $sImg, $isSetAvatarForCouple = false )

_uploadImage() public method

public _uploadImage ( $iProfileId )

actionAdministration() public method

actionGetSiteAvatars() public method

public actionGetSiteAvatars ( $iPage )

actionHome() public method

public actionHome ( )

actionMemberThumb() public method

public actionMemberThumb ( $iProfileId )

actionRemoveAvatar() public method

public actionRemoveAvatar ( $iProfileId, $sImg )

actionSetAvatar() public method

public actionSetAvatar ( $iProfileId, $sImg )

actionSetAvatarCouple() public method

public actionSetAvatarCouple ( $iProfileId, $sImg )

actionSetSiteAvatar() public method

public actionSetSiteAvatar ( $sImg )

isAdmin() public method

public isAdmin ( )

isAllowedAdd() public method

================================== permissions
public isAllowedAdd ( $isPerformAction = false )

isAllowedDelete() public method

public isAllowedDelete ( &$aDataEntry, $isPerformAction = false )

isAllowedEdit() public method

public isAllowedEdit ( $aDataEntry, $isPerformAction = false )

onEventChanged() public method

public onEventChanged ( $iProfileId, $iEntryId, $iCoupleProfileId, $isTryToSuspend = true )

onEventCreate() public method

================================== events
public onEventCreate ( $iEntryId )

onEventDeleted() public method

public onEventDeleted ( $iEntryId, $aDataEntry = [] )

serviceCropTool() public method

Returns crop image html, it consists of image for cropping, cropping preview and descriptions
public serviceCropTool ( $aParams )
$aParams dir_image - image path url_image - image url

serviceDeleteProfileAvatars() public method

Delete all profile's avatars
public serviceDeleteProfileAvatars ( $iProfileId ) : true
$iProfileId - profile ID to delete avatar for
return true on success, false on error

serviceGetMyAvatars() public method

My avatars html
public serviceGetMyAvatars ( $iProfileId ) : html
$iProfileId - profile's ID to display avatars for
return html with my avatars

serviceGetSiteAvatars() public method

Site avatars html
public serviceGetSiteAvatars ( $iPage ) : html
$iPage - current page in site avatars
return html with site avatars

serviceGetWallData() public method

Register 'add avatar' and 'change avatar' events for wall
public serviceGetWallData ( )

serviceGetWallPost() public method

Html to display on profile wall, when user uploads new avatar
public serviceGetWallPost ( $aEvent ) : html
$aEvent - wall event parameters
return html to post on profile's wall

serviceJoin() public method

After join redirection This serice automatically log in joined user and redirects him to avatar copping page
public serviceJoin ( $iMemID, $sStatusText ) : false
$iMemID - joined profile ID
$sStatusText - status text to display at the top of page, like 'join success'
return false on error, 'EXIT' string on success

serviceMakeAvatarFromImage() public method

make avatar from particular image, also it makes it square
public serviceMakeAvatarFromImage ( $sImg ) : true
$sImg path to the image
return true on success or false on error

serviceMakeAvatarFromImageUrl() public method

make avatar from image url, also it makes it square
public serviceMakeAvatarFromImageUrl ( $sImgUrl ) : true
return true on success or false on error

serviceMakeAvatarFromSharedPhotoAuto() public method

get image from photos module and make avatar from it also it makes it square
public serviceMakeAvatarFromSharedPhotoAuto ( $iSharedPhotoId ) : true
$iSharedPhotoId photo id from photos module
return true on success or false on error

serviceManageAvatars() public method

public serviceManageAvatars ( $iProfileId, $isAddJsCss = false )

serviceSetImageForCropping() public method

You can point image for cropping and then redirect to avatar module page, your image will be ready for cropping. You can use it in your module, if you want allow users to set any image from your module as avatar.
public serviceSetImageForCropping ( $iProfileId, $sOrigPath ) : true
$iProfileId - profile id to set avatar for
$sOrigPath - image path
return true on succrss, false on error

Property Details

$_aAllowedExt public_oe property

public $_aAllowedExt

$_iProfileId public_oe property

public $_iProfileId