private static function easydiscuss($profile) { $legacy = $profile->avatar == 'default.png' || $profile->avatar == 'media/com_easydiscuss/images/default.png' || empty($profile->avatar); $avatarLink = $legacy ? '/media/com_easydiscuss/images/default.png' : DiscussImageHelper::getAvatarRelativePath() . '/' . $profile->avatar; $avatarLink = DISCUSS_JURIROOT . '/' . $avatarLink; $profileLink = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $profile->id, false); return array($avatarLink, $profileLink); }
/** * Searches for an image tag in a given content. * * @since 3.0 * @access public */ public static function searchImage($content) { // Search for first image in a content $image = ''; $pattern = '#<img[^>]*>#i'; preg_match($pattern, $content, $matches); // If there's a match, get hold of the image as we need to run some processing. if ($matches && isset($matches[0])) { $image = $matches[0]; // Try to just get the image url. $pattern = '/src=[\\"\']?([^\\"\']?.*(png|jpg|jpeg|gif))[\\"\']?/i'; preg_match($pattern, $image, $matches); if ($matches && isset($matches[1])) { $image = $matches[1]; $image = DiscussImageHelper::rel2abs($image, DISCUSS_JURIROOT); } } if (!$image) { return false; } return $image; }
public static function uploadMediaAvatar($mediaType, $mediaTable, $isFromBackend = false) { jimport('joomla.utilities.error'); jimport('joomla.filesystem.file'); jimport('joomla.filesystem.folder'); $my = JFactory::getUser(); $mainframe = JFactory::getApplication(); $config = DiscussHelper::getConfig(); //$acl = DiscussACLHelper::getRuleSet(); // required params $layout_type = $mediaType == 'category' ? 'categories' : 'teamblogs'; $view_type = $mediaType == 'category' ? 'categories' : 'teamblogs'; $default_avatar_type = $mediaType == 'category' ? 'default_category.png' : 'default_team.png'; if (!$isFromBackend && $mediaType == 'category') { $url = 'index.php?option=com_easydiscuss&view=categories'; DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_NO_PERMISSION_TO_UPLOAD_AVATAR'), 'warning'); $mainframe->redirect(DiscussRouter::_($url, false)); } $avatar_config_path = $mediaType == 'category' ? $config->get('main_categoryavatarpath') : $config->get('main_teamavatarpath'); $avatar_config_path = rtrim($avatar_config_path, '/'); $avatar_config_path = str_replace('/', DIRECTORY_SEPARATOR, $avatar_config_path); $upload_path = JPATH_ROOT . '/' . $avatar_config_path; $rel_upload_path = $avatar_config_path; $err = null; $file = JRequest::getVar('Filedata', '', 'files', 'array'); //check whether the upload folder exist or not. if not create it. if (!JFolder::exists($upload_path)) { if (!JFolder::create($upload_path)) { // Redirect if (!$isFromBackend) { DiscussHelper::setMessageQueue(JText::_('COM_EASYDISCUSS_IMAGE_UPLOADER_FAILED_TO_CREATE_UPLOAD_FOLDER'), 'error'); $this->setRedirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false)); } else { //from backend $this->setRedirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false), JText::_('COM_EASYDISCUSS_IMAGE_UPLOADER_FAILED_TO_CREATE_UPLOAD_FOLDER'), 'error'); } return; } else { // folder created. now copy index.html into this folder. if (!JFile::exists($upload_path . '/index.html')) { $targetFile = DISCUSS_ROOT . '/index.html'; $destFile = $upload_path . '/index.html'; if (JFile::exists($targetFile)) { JFile::copy($targetFile, $destFile); } } } } //makesafe on the file $file['name'] = $mediaTable->id . '_' . JFile::makeSafe($file['name']); if (isset($file['name'])) { $target_file_path = $upload_path; $relative_target_file = $rel_upload_path . '/' . $file['name']; $target_file = JPath::clean($target_file_path . '/' . JFile::makeSafe($file['name'])); $isNew = false; require_once DISCUSS_HELPERS . '/image.php'; require_once DISCUSS_CLASSES . '/simpleimage.php'; if (!DiscussImageHelper::canUpload($file, $err)) { if (!$isFromBackend) { DiscussHelper::setMessageQueue(JText::_($err), 'error'); $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false)); } else { // From backend $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories'), JText::_($err), 'error'); } return; } if (0 != (int) $file['error']) { if (!$isFromBackend) { DiscussHelper::setMessageQueue($file['error'], 'error'); $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false)); } else { // From backend $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false), $file['error'], 'error'); } return; } // Rename the file 1st. $oldAvatar = empty($mediaTable->avatar) ? $default_avatar_type : $mediaTable->avatar; $tempAvatar = ''; if ($oldAvatar != $default_avatar_type) { $session = JFactory::getSession(); $sessionId = $session->getToken(); $fileExt = JFile::getExt(JPath::clean($target_file_path . '/' . $oldAvatar)); $tempAvatar = JPath::clean($target_file_path . '/' . $sessionId . '.' . $fileExt); JFile::move($target_file_path . '/' . $oldAvatar, $tempAvatar); } else { $isNew = true; } if (JFile::exists($target_file)) { if ($oldAvatar != $default_avatar_type) { //rename back to the previous one. JFile::move($tempAvatar, $target_file_path . '/' . $oldAvatar); } if (!$isFromBackend) { DiscussHelper::setMessageQueue(JText::sprintf('ERROR.FILE_ALREADY_EXISTS', $relative_target_file), 'error'); $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false)); } else { //from backend $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false), JText::sprintf('ERROR.FILE_ALREADY_EXISTS', $relative_target_file), 'error'); } return; } if (JFolder::exists($target_file)) { if ($oldAvatar != $default_avatar_type) { //rename back to the previous one. JFile::move($tempAvatar, $target_file_path . '/' . $oldAvatar); } if (!$isFromBackend) { //JError::raiseNotice(100, JText::sprintf('ERROR.FOLDER_ALREADY_EXISTS',$relative_target_file)); DiscussHelper::setMessageQueue(JText::sprintf('ERROR.FOLDER_ALREADY_EXISTS', $relative_target_file), 'error'); $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false)); } else { //from backend $mainframe->redirect(DiscussRouter::_('index.php?option=com_easydiscuss&view=categories', false), JText::sprintf('ERROR.FILE_ALREADY_EXISTS', $relative_target_file), 'error'); } return; } $configImageWidth = DISCUSS_AVATAR_LARGE_WIDTH; $configImageHeight = DISCUSS_AVATAR_LARGE_HEIGHT; $image = new SimpleImage(); $image->load($file['tmp_name']); $image->resize($configImageWidth, $configImageHeight); $image->save($target_file, $image->image_type); //now we update the user avatar. If needed, we remove the old avatar. if ($oldAvatar != $default_avatar_type) { if (JFile::exists($tempAvatar)) { JFile::delete($tempAvatar); } } return JFile::makeSafe($file['name']); } else { return $default_avatar_type; } }
function removeEasyDiscussUser($userId) { $db = DiscussHelper::getDBO(); $query = 'SELECT `avatar` FROM `#__discuss_users`'; $query .= ' WHERE `id` = ' . $db->Quote($userId) . ' '; $db->setQuery($query); $user = $db->loadAssoc(); if (!empty($user) && $user['avatar'] != 'default.png') { DiscussHelper::getHelper('image'); $avatar_link = DiscussImageHelper::getAvatarRelativePath() . '/' . $user['avatar']; $imagePath = str_replace('/', DIRECTORY_SEPARATOR, $avatar_link); if (JFile::exists($imagePath)) { JFile::delete($imagePath); } } $query = 'DELETE FROM `#__discuss_users`'; $query .= ' WHERE `id` = ' . $db->Quote($userId); $db->setQuery($query); $db->query(); if ($db->getErrorNum()) { JError::raiseError(500, $db->stderr()); } }
public static function getAvatarDimension($avatar) { //resize the avatar image $avatar = JPath::clean(JPATH_ROOT . '/' . $avatar); $info = getimagesize($avatar); if (!$info === false) { $thumb = DiscussImageHelper::imageResize($info[0], $info[1], 60); } else { $config = DiscussHelper::getConfig(); $thumb = array($config->get('layout_avatarthumbwidth', 60), $config->get('layout_avatarthumbheight', 60)); } return $thumb; }
public function onPrepareAvatars(&$comments) { $db = JFactory::getDBO(); $avatar_type = $this->params->get('avatar_type', 'gravatar'); $avatar_default_avatar = $this->params->get('avatar_default_avatar'); $avatar_custom_default_avatar = $this->params->get('avatar_custom_default_avatar'); $avatar_link = $this->params->get('avatar_link', 0); $avatar_link_target = $this->params->get('avatar_link_target'); $avatar_link_target = $avatar_link_target != '_self' ? ' target="' . $avatar_link_target . '"' : ''; $users = array(); foreach ($comments as &$comment) { if ($comment->userid != 0) { $users[] = (int)$comment->userid; } $comment->avatar = ''; } $users = array_unique($users); $avatars = array(); switch ($avatar_type) { case 'aup': if (count($users)) { $db->setQuery('SELECT userid, avatar, referreid FROM #__alpha_userpoints WHERE userid in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $Itemid = self::getItemid('index.php?option=com_alphauserpoints&view=users'); if (empty($Itemid)) { $Itemid = self::getItemid('index.php?option=com_alphauserpoints&view=account'); } $avatarA = JPATH_SITE . '/components/com_alphauserpoints/assets/images/avatars/'; $avatarL = JURI::base() . 'components/com_alphauserpoints/assets/images/avatars/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? JRoute::_('index.php?option=com_alphauserpoints&view=account&userid=' . $avatars[$uid]->referreid . $Itemid) : ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (is_file($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } break; case 'cb': if (count($users)) { $db->setQuery('SELECT user_id, avatar FROM #__comprofiler WHERE user_id in (' . implode(',', $users) . ') AND avatarapproved = 1'); $avatars = $db->loadObjectList('user_id'); } $Itemid = self::getItemid('index.php?option=com_comprofiler&task=profile'); if (empty($Itemid)) { $Itemid = self::getItemid('index.php?option=com_comprofiler&task=userslist'); if (empty($Itemid)) { $Itemid = self::getItemid('index.php?option=com_comprofiler'); } } foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? JRoute::_('index.php?option=com_comprofiler&task=userProfile&user='******''; if (isset($avatars[$uid]) && !empty($avatars[$uid]->avatar)) { $tn = strpos($avatars[$uid]->avatar, 'gallery') === 0 ? '' : 'tn'; $comment->avatar = JURI::base() . 'images/comprofiler/' . $tn . $avatars[$uid]->avatar; } } break; case 'contacts': if (count($users)) { $query = 'SELECT cd.user_id as userid, cd.image as avatar' . ' , CASE WHEN CHAR_LENGTH(cd.alias) THEN CONCAT_WS(":", cd.id, cd.alias) ELSE cd.id END as slug' . ' , CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug' . ' FROM #__contact_details AS cd ' . ' INNER JOIN #__categories AS cc on cd.catid = cc.id' . ' WHERE cd.user_id in (' . implode(',', $users) . ')'; $db->setQuery($query); $avatars = $db->loadObjectList('userid'); } foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? JRoute::_('index.php?option=com_contact&view=contact&id=' . $avatars[$uid]->slug . '&catid=' . $avatars[$uid]->catslug) : ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { $comment->avatar = JURI::base() . '/' . $avatars[$uid]->avatar; } } break; case 'discussions': if (count($users)) { $db->setQuery('SELECT id as userid, avatar FROM #__discussions_users WHERE id in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $avatarA = JPATH_SITE . '/images/discussions/users/'; $avatarL = JURI::base() . 'images/discussions/users/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (file_exists($avatarA . $uid . '/large/' . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $uid . '/large/' . $avatars[$uid]->avatar; } } } break; case 'easyblog': $router = JPATH_SITE . '/components/com_easyblog/helpers/router.php'; if (is_file($router)) { require_once($router); require_once(EBLOG_HELPERS . '/image.php'); if (count($users)) { $db->setQuery('SELECT id as userid, avatar FROM #__easyblog_users WHERE id in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $avatarA = JPATH_ROOT . DS . EasyImageHelper::getAvatarRelativePath() . DS; $avatarL = JURI::base() . EasyImageHelper::getAvatarRelativePath() . '/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = EasyBlogRouter::_('index.php?option=com_easyblog&view=blogger&layout=listings&id=' . $uid, false); if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (file_exists($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } break; case 'easydiscuss': $router = JPATH_SITE . '/components/com_easydiscuss/helpers/router.php'; if (is_file($router)) { require_once($router); require_once(JPATH_SITE . '/components/com_easydiscuss/helpers/helper.php'); require_once(JPATH_SITE . '/components/com_easydiscuss/helpers/image.php'); if (count($users)) { $db->setQuery('SELECT id as userid, avatar FROM #__discuss_users WHERE id in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $avatarA = JPATH_ROOT . DS . DiscussImageHelper::getAvatarRelativePath() . DS; $avatarL = JURI::base() . DiscussImageHelper::getAvatarRelativePath() . '/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = DiscussRouter::_('index.php?option=com_easydiscuss&view=profile&id=' . $uid, false); if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (file_exists($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } break; case 'jomsocial': if (count($users)) { $db->setQuery('SELECT userid, thumb as avatar FROM #__community_users WHERE userid in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $avatarA = JPATH_SITE . DS; $avatarL = JURI::base() . '/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? JRoute::_('index.php?option=com_community&view=profile&userid=' . $uid) : ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '' && $avatars[$uid]->avatar != 'components/com_community/assets/default_thumb.jpg') { if (file_exists($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } break; case 'joobb': $cfgFile = JPATH_SITE . '/components/com_joobb/system/joobbconfig.php'; if (is_file($cfgFile)) { include_once($cfgFile); if (count($users)) { $db->setQuery('SELECT id, avatar_file as avatar FROM #__joobb_users WHERE id in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('id'); } $Itemid = self::getItemid('index.php?option=com_joobb'); $config = JoobbConfig::getInstance(); $avatarsPath = $config->getAvatarSettings('avatar_path'); $avatarA = JPATH_SITE . DS . $avatarsPath . DS; $avatarL = JURI::root() . '/' . $avatarsPath . '/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? JRoute::_('index.php?option=com_joobb&view=profile&id=' . $avatars[$uid]->id . $Itemid) : ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (file_exists($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } break; case 'k2': $router = JPATH_SITE . '/components/com_k2/helpers/route.php'; if (is_file($router)) { require_once($router); require_once(JPATH_SITE . '/components/com_k2/helpers/utilities.php'); if (count($users)) { $db->setQuery('SELECT userid, image as avatar FROM #__k2_users WHERE userid in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $avatarA = JPATH_SITE . '/media/k2/users/'; $avatarL = JURI::base() . 'media/k2/users/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? JRoute::_(K2HelperRoute::getUserRoute($uid)) : ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (file_exists($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } break; case 'kunena': $api = JPATH_ADMINISTRATOR . '/components/com_kunena/api.php'; if (is_file($api)) { require_once($api); if (count($users)) { $db->setQuery('SELECT userid, avatar FROM #__kunena_users WHERE userid in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $avatarA = JPATH_SITE . '/media/kunena/avatars/'; $avatarL = JURI::base() . 'media/kunena/avatars/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? KunenaRoute::_('index.php?option=com_kunena&func=profile&userid=' . $uid) : ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (is_file($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } break; case 'phocagallery': $helper = JPATH_SITE . '/components/com_phocagallery/libraries/phocagallery/path/path.php'; if (is_file($helper)) { require_once($helper); if (count($users)) { $db->setQuery('SELECT userid, avatar FROM #__phocagallery_user WHERE userid in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $path = PhocaGalleryPath::getPath(); $avatarA = $path->avatar_abs; $avatarL = $path->avatar_rel; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (is_file($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } break; case 'slogin': $helper = JPATH_SITE . '/plugins/slogin_integration/profile/profile.php'; if (is_file($helper)) { if (count($users)) { $db->setQuery('SELECT user_id as userid, social_profile_link as link, avatar FROM #__plg_slogin_profile WHERE current_profile = 1 AND user_id in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $plugin = JPluginHelper::getPlugin('slogin_integration', 'profile'); $pluginParams = new JRegistry(); $pluginParams->loadString($plugin->params); $folder = $pluginParams->get('rootfolder', 'images/avatar'); $avatarA = JPATH_SITE . '/' . $folder . '/'; $avatarL = JURI::base() . $folder . '/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $avatars[$uid]->link; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (file_exists($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } else { $helper = JPATH_SITE . '/plugins/slogin_integration/slogin_avatar/slogin_avatar.php'; if (is_file($helper)) { if (count($users)) { $db->setQuery('SELECT userid, photo_src as avatar FROM #__plg_slogin_avatar WHERE main = 1 AND userid in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } $plugin = JPluginHelper::getPlugin('slogin_integration', 'slogin_avatar'); $pluginParams = new JRegistry(); $pluginParams->loadString($plugin->params); $folder = $pluginParams->get('rootfolder', 'images/avatar'); $avatarA = JPATH_SITE . '/' . $folder . '/'; $avatarL = JURI::base() . $folder . '/'; foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (file_exists($avatarA . $avatars[$uid]->avatar)) { $comment->avatar = $avatarL . $avatars[$uid]->avatar; } } } } } break; case 'easyprofile': $api = JPATH_ADMINISTRATOR . '/components/com_jsn/jsn.php'; if (is_file($api)) { if (count($users)) { $db->setQuery('SELECT id as userid, avatar FROM #__jsn_users WHERE id in (' . implode(',', $users) . ')'); $avatars = $db->loadObjectList('userid'); } foreach ($comments as &$comment) { $uid = (int)$comment->userid; $comment->profileLink = $uid ? JRoute::_('index.php?option=com_jsn&view=profile&id=' . $uid) : ''; if (isset($avatars[$uid]) && $avatars[$uid]->avatar != '') { if (is_file(JPATH_SITE . '/' . $avatars[$uid]->avatar)) { $comment->avatar = JURI::base() . $avatars[$uid]->avatar; } } } } break; case 'gravatar': default: foreach ($comments as &$comment) { $comment->profileLink = ''; $comment->avatar = $this->getGravatar($comment->email); } break; } if ($avatar_default_avatar == 'custom' && empty($avatar_custom_default_avatar)) { $avatar_default_avatar = 'default'; } foreach ($comments as &$comment) { if (empty($comment->avatar)) { switch ($avatar_default_avatar) { case 'gravatar': $comment->avatar = $this->getGravatar($comment->email); break; case 'custom': $comment->avatar = JURI::base() . ltrim($avatar_custom_default_avatar, '/'); break; case 'default': $comment->avatar = JURI::base() . 'components/com_jcomments/images/no_avatar.png'; break; } } $comment->avatar = self::createImg($comment->avatar, JComments::getCommentAuthorName($comment)); if ($avatar_link && !empty($comment->profileLink)) { $comment->avatar = self::createLink($comment->avatar, $comment->profileLink, $avatar_link_target); } } return; }
public function getAvatar() { $avatar_link = ''; if ($this->avatar == 'cdefault.png' || $this->avatar == 'default_category.png' || $this->avatar == 'components/com_easydiscuss/themes/default/images/default_category.png' || $this->avatar == 'components/com_easydiscuss/assets/images/cdefault.png' || $this->avatar == 'components/com_easydiscuss/themes/simplistic/images/default_category.png' || empty($this->avatar)) { $avatar_link = 'components/com_easydiscuss/themes/simplistic/images/default_category.png'; } else { $avatar_link = DiscussImageHelper::getAvatarRelativePath('category') . '/' . $this->avatar; } return rtrim(JURI::root(), '/') . '/' . $avatar_link; }