本文整理汇总了PHP中BOL_AvatarService::getAvatarPath方法的典型用法代码示例。如果您正苦于以下问题:PHP BOL_AvatarService::getAvatarPath方法的具体用法?PHP BOL_AvatarService::getAvatarPath怎么用?PHP BOL_AvatarService::getAvatarPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BOL_AvatarService
的用法示例。
在下文中一共展示了BOL_AvatarService::getAvatarPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterAvatarChange
public function afterAvatarChange(OW_Event $event)
{
$params = $event->getParams();
$userId = $params['userId'];
$avatar = $this->avatarService->findByUserId($userId);
$uAvatar = new UAVATARS_BOL_Avatar();
$uAvatar->avatarId = $avatar->id;
$uAvatar->userId = $userId;
$avatarPath = $this->avatarService->getAvatarPath($userId, 3);
$tmpPath = OW::getPluginManager()->getPlugin("uavatars")->getPluginFilesDir() . uniqid("tmp-") . '.jpg';
if (!OW::getStorage()->copyFileToLocalFS($avatarPath, $tmpPath)) {
return;
}
$photoStatus = $avatar->status == "active" ? "approved" : "approval";
$photoId = $this->photoBridge->addPhoto($userId, $tmpPath, "", null, false, $photoStatus);
@unlink($tmpPath);
if (empty($photoId)) {
return;
}
$uAvatar->photoId = $photoId;
$uAvatar->timeStamp = time();
$avatarPreview = $this->avatarService->getAvatarPath($userId, 2);
$fileName = $this->uAvatarsService->storeAvatarImage($avatarPreview);
if (empty($fileName)) {
return;
}
if (!empty($uAvatar->fileName)) {
$userfilesDir = OW::getPluginManager()->getPlugin('uavatars')->getUserFilesDir();
OW::getStorage()->removeFile($userfilesDir . $uAvatar->fileName);
}
$uAvatar->fileName = $fileName;
$this->uAvatarsService->saveAvatar($uAvatar);
}
示例2: afterAvatarChange
public function afterAvatarChange(OW_Event $event)
{
$params = $event->getParams();
$userId = $params['userId'];
$avatar = $this->avatarService->findByUserId($userId);
if ($params['upload']) {
$uAvatar = new UAVATARS_BOL_Avatar();
$uAvatar->avatarId = $avatar->id;
$uAvatar->userId = $userId;
$avatarPath = $this->avatarService->getAvatarPath($userId, 3);
$photoId = $this->photoBridge->addPhoto($userId, $avatarPath);
if (empty($photoId)) {
return;
}
$uAvatar->photoId = $photoId;
$uAvatar->timeStamp = time();
} else {
$uAvatar = $this->uAvatarsService->findLastByUserId($userId);
}
$avatarPreview = $this->avatarService->getAvatarPath($userId, 2);
$fileName = $this->uAvatarsService->storeAvatarImage($avatarPreview);
if (empty($fileName)) {
return;
}
if (!empty($uAvatar->fileName)) {
$userfilesDir = OW::getPluginManager()->getPlugin('uavatars')->getUserFilesDir();
OW::getStorage()->removeFile($userfilesDir . $uAvatar->fileName);
}
$uAvatar->fileName = $fileName;
$this->uAvatarsService->saveAvatar($uAvatar);
}