/** * gets the image path for a users avatar * @param \UserInfo $uo * @param bool $withNoCacheStr * @return bool|string $src */ public function getImagePath($uo, $withNoCacheStr = true) { if (!$uo->hasAvatar()) { return false; } $avatar = $uo->getUserAvatar(); return $avatar->getPath(); }
/** * gets the image path for a users avatar * @param \UserInfo $uo * @param bool $withNoCacheStr * @return bool|string $src */ public function getImagePath($uo, $withNoCacheStr = true) { if (!$uo->hasAvatar()) { return false; } $fsl = StorageLocation::getDefault(); $fs = $fsl->getFileSystemObject(); if ($fs->has(REL_DIR_FILES_AVATARS . '/' . $uo->getUserID() . '.jpg')) { $configuration = $fsl->getConfigurationObject(); $src = $configuration->getPublicURLToFile(REL_DIR_FILES_AVATARS . '/' . $uo->getUserID() . '.jpg'); $cacheStr = "?" . time(); if ($withNoCacheStr) { $src .= $cacheStr; } return $src; } }