Exemplo n.º 1
0
 /**
  * Get large avatar use for cropping
  * @return string
  */
 public function getLargeAvatar()
 {
     $config = CFactory::getConfig();
     $largeAvatar = $config->getString('imagefolder') . '/avatar/profile-' . JFile::getName($this->avatar);
     if (JFile::exists(JPATH_ROOT . '/' . $largeAvatar)) {
         return CUrlHelper::avatarURI($largeAvatar) . '?' . md5(time());
         /* adding random param to prevent browser caching */
     } else {
         return $this->getAvatar();
     }
 }
Exemplo n.º 2
0
 public function getAvatar()
 {
     // Get the avatar path. Some maintance/cleaning work: We no longer store
     // the default avatar in db. If the default avatar is found, we reset it
     // to empty. In next release, we'll rewrite this portion accordingly.
     // We allow the default avatar to be template specific.
     if ($this->avatar == 'components/com_community/assets/user.png') {
         $this->avatar = '';
         $this->store();
     }
     CFactory::load('helpers', 'url');
     $avatar = CUrlHelper::avatarURI($this->avatar, 'user.png');
     return $avatar;
 }
Exemplo n.º 3
0
 public function getAvatar()
 {
     // Get the avatar path. Some maintance/cleaning work: We no longer store
     // the default avatar in db. If the default avatar is found, we reset it
     // to empty. In next release, we'll rewrite this portion accordingly.
     // We allow the default avatar to be template specific.
     $profileModel = CFactory::getModel('Profile');
     $gender = $profileModel->getGender($this->userid);
     if (empty($gender)) {
         $gender = 'Male';
     }
     if ($this->avatar == 'components/com_community/assets/user-' . JText::_($gender) . '.png') {
         $this->avatar = '';
         $this->store();
     }
     $avatar = CUrlHelper::avatarURI($this->avatar, 'user-' . JText::_($gender) . '.png');
     return $avatar;
 }
Exemplo n.º 4
0
 /**
  * Called when the user uploaded a new photo and process avatar upload & resize
  * @return type
  */
 public function changeAvatar()
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     /* get variables */
     $type = $jinput->get('type', null, 'NONE');
     $id = $jinput->get('id', null, 'INT');
     $saveAction = $jinput->get('repeattype', null, 'STRING');
     $filter = JFilterInput::getInstance();
     $type = $filter->clean($type, 'string');
     $id = $filter->clean($id, 'integer');
     $params = new JRegistry();
     $cTable = JTable::getInstance(ucfirst($type), 'CTable');
     $cTable->load($id);
     if ($type == "profile") {
         $my = CFactory::getUser($id);
     } else {
         $my = CFactory::getUser();
     }
     $config = CFactory::getConfig();
     $userid = $my->id;
     $fileFilter = new JInput($_FILES);
     $file = $fileFilter->get('filedata', '', 'array');
     if (!CImageHelper::checkImageSize(filesize($file['tmp_name']))) {
         $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_VIDEOS_IMAGE_FILE_SIZE_EXCEEDED_MB', CFactory::getConfig()->get('maxuploadsize')));
         return;
     }
     //check if file is allwoed
     if (!CImageHelper::isValidType($file['type'])) {
         $this->_showUploadError(true, JText::_('COM_COMMUNITY_IMAGE_FILE_NOT_SUPPORTED'));
         return;
     }
     CImageHelper::autoRotate($file['tmp_name']);
     $album = JTable::getInstance('Album', 'CTable');
     //create the avatar default album if it does not exists
     if (!($albumId = $album->isAvatarAlbumExists($id, $type))) {
         $albumId = $album->addAvatarAlbum($id, $type);
     }
     //start image processing
     // Get a hash for the file name.
     $fileName = JApplication::getHash($file['tmp_name'] . time());
     $hashFileName = JString::substr($fileName, 0, 24);
     $avatarFolder = $type != 'profile' && $type != '' ? $type . '/' : '';
     //avatar store path
     $storage = JPATH_ROOT . '/' . $config->getString('imagefolder') . '/avatar' . '/' . $avatarFolder;
     if (!JFolder::exists($storage)) {
         JFolder::create($storage);
     }
     $storageImage = $storage . '/' . $hashFileName . CImageHelper::getExtension($file['type']);
     $image = $config->getString('imagefolder') . '/avatar/' . $avatarFolder . $hashFileName . CImageHelper::getExtension($file['type']);
     /**
      * reverse image use for cropping feature
      * @uses <type>-<hashFileName>.<ext>
      */
     $storageReserve = $storage . '/' . $type . '-' . $hashFileName . CImageHelper::getExtension($file['type']);
     // filename for stream attachment
     $imageAttachment = $config->getString('imagefolder') . '/avatar/' . $hashFileName . '_stream_' . CImageHelper::getExtension($file['type']);
     //avatar thumbnail path
     $storageThumbnail = $storage . '/thumb_' . $hashFileName . CImageHelper::getExtension($file['type']);
     $thumbnail = $config->getString('imagefolder') . '/avatar/' . $avatarFolder . 'thumb_' . $hashFileName . CImageHelper::getExtension($file['type']);
     //Minimum height/width checking for Avatar uploads
     list($currentWidth, $currentHeight) = getimagesize($file['tmp_name']);
     if ($currentWidth < COMMUNITY_AVATAR_PROFILE_WIDTH || $currentHeight < COMMUNITY_AVATAR_PROFILE_HEIGHT) {
         $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_ERROR_MINIMUM_AVATAR_DIMENSION', COMMUNITY_AVATAR_PROFILE_WIDTH, COMMUNITY_AVATAR_PROFILE_HEIGHT));
         return;
     }
     /**
      * Generate square avatar
      */
     if (!CImageHelper::createThumb($file['tmp_name'], $storageImage, $file['type'], COMMUNITY_AVATAR_PROFILE_WIDTH, COMMUNITY_AVATAR_PROFILE_HEIGHT)) {
         $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_ERROR_MOVING_UPLOADED_FILE', $storageImage));
         return;
     }
     // Generate thumbnail
     if (!CImageHelper::createThumb($file['tmp_name'], $storageThumbnail, $file['type'])) {
         $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_ERROR_MOVING_UPLOADED_FILE', $storageImage));
         return;
     }
     /**
      * Generate large image use for avatar thumb cropping
      * It must be larget than profile avatar size because we'll use it for profile avatar recrop also
      */
     $newWidth = 0;
     $newHeight = 0;
     if ($currentWidth >= $currentHeight) {
         if ($this->testResize($currentWidth, $currentHeight, COMMUNITY_AVATAR_RESERVE_WIDTH, 0, COMMUNITY_AVATAR_PROFILE_WIDTH, COMMUNITY_AVATAR_RESERVE_WIDTH)) {
             $newWidth = COMMUNITY_AVATAR_RESERVE_WIDTH;
             $newHeight = 0;
         } else {
             $newWidth = 0;
             $newHeight = COMMUNITY_AVATAR_RESERVE_HEIGHT;
         }
     } else {
         if ($this->testResize($currentWidth, $currentHeight, 0, COMMUNITY_AVATAR_RESERVE_HEIGHT, COMMUNITY_AVATAR_PROFILE_HEIGHT, COMMUNITY_AVATAR_RESERVE_HEIGHT)) {
             $newWidth = 0;
             $newHeight = COMMUNITY_AVATAR_RESERVE_HEIGHT;
         } else {
             $newWidth = COMMUNITY_AVATAR_RESERVE_WIDTH;
             $newHeight = 0;
         }
     }
     if (!CImageHelper::resizeProportional($file['tmp_name'], $storageReserve, $file['type'], $newWidth, $newHeight)) {
         $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_ERROR_MOVING_UPLOADED_FILE', $storageReserve));
         return;
     }
     /*
      * Generate photo to be stored in default avatar album
      * notes: just in case this need to be used in registration, just get the code below.
      */
     $originalPath = $storage . 'original_' . md5($my->id . '_avatar' . time()) . CImageHelper::getExtension($file['type']);
     $fullImagePath = $storage . md5($my->id . '_avatar' . time()) . CImageHelper::getExtension($file['type']);
     $thumbPath = $storage . 'thumb_' . md5($my->id . '_avatar' . time()) . CImageHelper::getExtension($file['type']);
     // Generate full image
     if (!CImageHelper::resizeProportional($file['tmp_name'], $fullImagePath, $file['type'], 1024)) {
         $msg['error'] = JText::sprintf('COM_COMMUNITY_ERROR_MOVING_UPLOADED_FILE', $file['tmp_name']);
         echo json_encode($msg);
         exit;
     }
     CPhotos::generateThumbnail($file['tmp_name'], $thumbPath, $file['type']);
     if (!JFile::copy($file['tmp_name'], $originalPath)) {
         exit;
     }
     //store this picture into default avatar album
     $now = new JDate();
     $photo = JTable::getInstance('Photo', 'CTable');
     $photo->albumid = $albumId;
     $photo->image = str_replace(JPATH_ROOT . '/', '', $fullImagePath);
     $photo->caption = $file['name'];
     $photo->filesize = $file['size'];
     $photo->creator = $my->id;
     $photo->created = $now->toSql();
     $photo->published = 1;
     $photo->thumbnail = str_replace(JPATH_ROOT . '/', '', $thumbPath);
     $photo->original = str_replace(JPATH_ROOT . '/', '', $originalPath);
     if ($photo->store()) {
         $album->load($albumId);
         $album->photoid = $photo->id;
         $album->setParam('thumbnail', $photo->thumbnail);
         $album->store();
     }
     //end storing user avatar in avatar album
     if ($type == 'profile') {
         $profileType = $my->getProfileType();
         $multiprofile = JTable::getInstance('MultiProfile', 'CTable');
         $multiprofile->load($profileType);
         $useWatermark = $profileType != COMMUNITY_DEFAULT_PROFILE && $config->get('profile_multiprofile') && !empty($multiprofile->watermark) ? true : false;
         if ($useWatermark && $multiprofile->watermark) {
             JFile::copy($storageImage, JPATH_ROOT . '/images/watermarks/original' . '/' . md5($my->id . '_avatar') . CImageHelper::getExtension($file['type']));
             JFile::copy($storageThumbnail, JPATH_ROOT . '/images/watermarks/original' . '/' . md5($my->id . '_thumb') . CImageHelper::getExtension($file['type']));
             $watermarkPath = JPATH_ROOT . '/' . CString::str_ireplace('/', '/', $multiprofile->watermark);
             list($watermarkWidth, $watermarkHeight) = getimagesize($watermarkPath);
             list($avatarWidth, $avatarHeight) = getimagesize($storageImage);
             list($thumbWidth, $thumbHeight) = getimagesize($storageThumbnail);
             $watermarkImage = $storageImage;
             $watermarkThumbnail = $storageThumbnail;
             // Avatar Properties
             $avatarPosition = CImageHelper::getPositions($multiprofile->watermark_location, $avatarWidth, $avatarHeight, $watermarkWidth, $watermarkHeight);
             // The original image file will be removed from the system once it generates a new watermark image.
             CImageHelper::addWatermark($storageImage, $watermarkImage, $file['type'], $watermarkPath, $avatarPosition->x, $avatarPosition->y);
             //Thumbnail Properties
             $thumbPosition = CImageHelper::getPositions($multiprofile->watermark_location, $thumbWidth, $thumbHeight, $watermarkWidth, $watermarkHeight);
             // The original thumbnail file will be removed from the system once it generates a new watermark image.
             CImageHelper::addWatermark($storageThumbnail, $watermarkThumbnail, $file['type'], $watermarkPath, $thumbPosition->x, $thumbPosition->y);
             $my->set('_watermark_hash', $multiprofile->watermark_hash);
         }
         // We need to make a copy of current avatar and set it as stream 'attachement'
         // which will only gets deleted once teh stream is deleted
         $my->_cparams->set('avatar_photo_id', $photo->id);
         //we also set the id of the avatar photo
         $my->save();
         JFile::copy($image, $imageAttachment);
         $params->set('attachment', $imageAttachment);
     }
     //end of storing this picture into default avatar album
     if (empty($saveAction)) {
         $cTable->setImage($image, 'avatar');
         $cTable->setImage($thumbnail, 'thumb');
     } else {
         // This is for event recurring save option ( current / future event )
         $cTable->setImage($image, 'avatar', $saveAction);
         $cTable->setImage($thumbnail, 'thumb', $saveAction);
     }
     // add points & activity stream
     switch ($type) {
         case 'profile':
             /**
              * Generate activity stream
              * @todo Should we use CApiActivities::add
              */
             // do not have to generate a stream if the user is not the user itself (eg admin change user avatar)
             if (CUserPoints::assignPoint('profile.avatar.upload') && $my->id == CFactory::getUser()->id) {
                 $act = new stdClass();
                 $act->cmd = 'profile.avatar.upload';
                 $act->actor = $userid;
                 $act->target = 0;
                 $act->title = '';
                 $act->content = '';
                 $act->access = $my->_cparams->get("privacyPhotoView", 0);
                 $act->app = 'profile.avatar.upload';
                 /* Profile app */
                 $act->cid = isset($photo->id) && $photo->id ? $photo->id : 0;
                 $act->verb = 'upload';
                 /* We uploaded new avatar - NOT change avatar */
                 $act->params = $params;
                 $params->set('photo_id', $photo->id);
                 $params->set('album_id', $photo->albumid);
                 $act->comment_id = CActivities::COMMENT_SELF;
                 $act->comment_type = 'profile.avatar.upload';
                 $act->like_id = CActivities::LIKE_SELF;
                 $act->like_type = 'profile.avatar.upload';
             }
             break;
         case 'group':
             CUserPoints::assignPoint('group.avatar.upload');
             /**
              * Generate activity stream
              * @todo Should we use CApiActivities::add
              */
             $act = new stdClass();
             $act->cmd = 'groups.avatar.upload';
             $act->actor = $userid;
             $act->target = 0;
             $act->title = '';
             $act->content = '';
             $act->app = 'groups.avatar.upload';
             /* Groups app */
             $act->cid = $id;
             $act->groupid = $id;
             $act->verb = 'update';
             /* We do update */
             $params->set('photo_id', $photo->id);
             $params->set('album_id', $photo->albumid);
             $act->comment_id = CActivities::COMMENT_SELF;
             $act->comment_type = 'groups.avatar.upload';
             $act->like_id = CActivities::LIKE_SELF;
             $act->like_type = 'groups.avatar.upload';
             break;
         case 'event':
             //CUserPoints::assignPoint('events.avatar.upload'); @disabled since 4.0
             /**
              * Generate activity stream
              * @todo Should we use CApiActivities::add
              */
             $act = new stdClass();
             $act->cmd = 'events.avatar.upload';
             $act->actor = $userid;
             $act->target = 0;
             $act->title = '';
             $act->content = '';
             $act->app = 'events.avatar.upload';
             /* Events app */
             $act->cid = $id;
             $act->eventid = $id;
             $act->verb = 'update';
             /* We do update */
             $act->comment_id = CActivities::COMMENT_SELF;
             $act->comment_type = 'events.avatar.upload';
             $act->like_id = CActivities::LIKE_SELF;
             $act->like_type = 'events.avatar.upload';
             break;
     }
     //we only generate stream if the uploader is the user himself, not admin or anyone else
     if (isset($act) && $my->id == $id || $type != 'profile') {
         // $return = CApiActivities::add($act);
         /**
          * use internal Stream instead use for 3rd part API
          */
         $return = CActivityStream::add($act, $params->toString());
         //add the reference to the activity so that we can do something when someone update the avatar
         if ($type == 'profile') {
             // overwrite the params because some of the param might be updated through $my object above
             $cTableParams = $my->_cparams;
         } else {
             $cTableParams = new JRegistry($cTable->params);
         }
         $cTableParams->set('avatar_activity_id', $return->id);
         $cTable->params = $cTableParams->toString();
         $cTable->store();
     }
     if (method_exists($cTable, 'getLargeAvatar')) {
         $this->_showUploadError(false, $cTable->getLargeAvatar(), CUrlHelper::avatarURI($thumbnail, 'user_thumb.png'));
     } else {
         $this->_showUploadError(false, $cTable->getAvatar(), CUrlHelper::avatarURI($thumbnail, 'user_thumb.png'));
     }
 }
Exemplo n.º 5
0
 /**
  * @deprecated Since 2.0
  */
 public function getThumbAvatar($id, $thumb)
 {
     $thumb = CUrlHelper::avatarURI($thumb, 'event_thumb.png');
     return $thumb;
 }
Exemplo n.º 6
0
 /**
  * Return full uri path of the thumbnail
  */
 public function getThumbAvatar()
 {
     if ($this->thumb == 'components/com_community/assets/event_thumb.png') {
         $this->thumb = '';
         $this->store();
     }
     CFactory::load('helpers', 'url');
     $thumb = CUrlHelper::avatarURI($this->thumb, 'event_thumb.png');
     return $thumb;
 }
Exemplo n.º 7
0
 public function getThumbAvatar()
 {
     if ($this->thumb == 'components/com_community/assets/group_thumb.jpg') {
         $this->thumb = '';
         $this->store();
     }
     // For group avatars that are stored in a remote location, we should return the proper path.
     if ($this->storage != 'file' && !empty($this->thumb)) {
         $storage = CStorage::getStorage($this->storage);
         return $storage->getURI($this->thumb);
     }
     $thumb = CUrlHelper::avatarURI($this->thumb, 'group_thumb.png');
     return $thumb;
 }
Exemplo n.º 8
0
 /**
  * @deprecated Since 2.0
  */
 function getThumbAvatar($id, $thumb)
 {
     CFactory::load('helpers', 'url');
     $thumb = CUrlHelper::avatarURI($thumb, 'event_thumb.png');
     return $thumb;
 }
Exemplo n.º 9
0
 /**
  * Return path to thumb image
  */
 public function getThumbAvatar()
 {
     // @rule: Check if the current user's watermark matches the current system's watermark.
     $multiprofile =& JTable::getInstance('MultiProfile', 'CTable');
     $match = $multiprofile->isHashMatched($this->_profile_id, $this->_watermark_hash);
     if (!$match) {
         // @rule: Since the admin may have changed the watermark for the specific user profile type, we need to also update
         // the user's watermark as well.
         CFactory::load('helpers', 'image');
         $hashName = CImageHelper::getHashName($this->id . time());
         $multiprofile->updateUserAvatar($this, $hashName);
         $multiprofile->updateUserThumb($this, $hashName);
     }
     if (JString::stristr($this->_thumb, 'default_thumb.jpg')) {
         $this->_thumb = '';
     }
     // For user avatars that are stored in a remote location, we should return the proper path.
     // @rule: For default avatars and watermark avatars we don't want to alter the url behavior.
     // as it should be stored locally.
     if ($this->_storage != 'file' && !empty($this->_thumb) && JString::stristr($this->_thumb, 'images/watermarks') === false) {
         $storage = CStorage::getStorage($this->_storage);
         return $storage->getURI($this->_thumb);
     }
     CFactory::load('helpers', 'url');
     $thumb = CUrlHelper::avatarURI($this->_thumb, 'user_thumb.png');
     return $thumb;
 }
Exemplo n.º 10
0
 public function getThumbAvatar($obj)
 {
     // For group avatars that are stored in a remote location, we should return the proper path.
     if ($obj->storage != 'file' && !empty($obj->thumb)) {
         $storage = CStorage::getStorage($obj->storage);
         return $storage->getURI($obj->thumb);
     }
     $thumb = CUrlHelper::avatarURI($obj->thumb, 'group_thumb.png');
     return $thumb;
 }
Exemplo n.º 11
0
 public function changeAvatar()
 {
     $objResponse = new JAXResponse();
     $type = JRequest::getVar('type');
     $id = JRequest::getVar('id');
     $filter = JFilterInput::getInstance();
     $type = $filter->clean($type, 'string');
     $id = $filter->clean($id, 'integer');
     $cTable =& JTable::getInstance(ucfirst($type), 'CTable');
     $cTable->load($id);
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     CFactory::load('helpers', 'image');
     $file = JRequest::getVar('filedata', '', 'FILES', 'array');
     //check if file is allwoed
     if (!CImageHelper::isValidType($file['type'])) {
         $this->_showUploadError(true, JText::_('COM_COMMUNITY_IMAGE_FILE_NOT_SUPPORTED'));
         return;
     }
     //check upload file size
     $uploadlimit = (double) $config->get('maxuploadsize');
     $uploadlimit = $uploadlimit * 1024 * 1024;
     if (filesize($file['tmp_name']) > $uploadlimit && $uploadlimit != 0) {
         $this->_showUploadError(true, JText::_('COM_COMMUNITY_VIDEOS_IMAGE_FILE_SIZE_EXCEEDED'));
         return;
     }
     //start image processing
     $imageMaxWidth = 160;
     // Get a hash for the file name.
     $fileName = JUtility::getHash($file['tmp_name'] . time());
     $hashFileName = JString::substr($fileName, 0, 24);
     $avatarFolder = $type != 'profile' && $type != '' ? $type . DS : '';
     //avatar store path
     $storage = JPATH_ROOT . DS . $config->getString('imagefolder') . DS . 'avatar' . DS . $avatarFolder;
     $storageImage = $storage . DS . $hashFileName . CImageHelper::getExtension($file['type']);
     $image = $config->getString('imagefolder') . '/avatar/' . $avatarFolder . $hashFileName . CImageHelper::getExtension($file['type']);
     //avatar thumbnail path
     $storageThumbnail = $storage . DS . 'thumb_' . $hashFileName . CImageHelper::getExtension($file['type']);
     $thumbnail = $config->getString('imagefolder') . '/avatar/' . $avatarFolder . 'thumb_' . $hashFileName . CImageHelper::getExtension($file['type']);
     // Generate full image
     if (!CImageHelper::resizeProportional($file['tmp_name'], $storageImage, $file['type'], $imageMaxWidth)) {
         $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_ERROR_MOVING_UPLOADED_FILE', $storageImage));
         return;
     }
     // Generate thumbnail
     if (!CImageHelper::createThumb($file['tmp_name'], $storageThumbnail, $file['type'])) {
         $this->_showUploadError(true, JText::sprintf('COM_COMMUNITY_ERROR_MOVING_UPLOADED_FILE', $storageImage));
         return;
     }
     $cTable->setImage($image, 'avatar');
     $cTable->setImage($thumbnail, 'thumb');
     $this->_showUploadError(false, $cTable->getAvatar(), CUrlHelper::avatarURI($thumbnail, 'user_thumb.png'));
 }
Exemplo n.º 12
0
 /**
  * Return path to thumb image
  */
 public function getThumbAvatar()
 {
     // @rule: Check if the current user's watermark matches the current system's watermark.
     $multiprofile = JTable::getInstance('MultiProfile', 'CTable');
     $match = $multiprofile->isHashMatched($this->_profile_id, $this->_watermark_hash);
     if (!$match) {
         // @rule: Since the admin may have changed the watermark for the specific user profile type, we need to also update
         // the user's watermark as well.
         //CFactory::load( 'helpers' , 'image' );
         $hashName = CImageHelper::getHashName($this->id . time());
         $multiprofile->updateUserAvatar($this, $hashName);
         $multiprofile->updateUserThumb($this, $hashName);
     }
     if (JString::stristr($this->_thumb, 'default_thumb.jpg')) {
         $this->_thumb = '';
     }
     // For user avatars that are stored in a remote location, we should return the proper path.
     // @rule: For default avatars and watermark avatars we don't want to alter the url behavior.
     // as it should be stored locally.
     if ($this->_storage != 'file' && !empty($this->_thumb) && JString::stristr($this->_thumb, 'images/watermarks') === false) {
         $storage = CStorage::getStorage($this->_storage);
         return $storage->getURI($this->_thumb);
     }
     if ($this->_thumb && file_exists(JPATH_ROOT . '/' . $this->_thumb)) {
         return JUri::root() . $this->_thumb;
     }
     $gender = $this->_getGender('male');
     if (!strlen($gender)) {
         $gender = 'undefined';
     }
     $td_path = "default-{$gender}-avatar";
     if (file_exists(COMMUNITY_PATH_ASSETS . $td_path . '.png')) {
         return JUri::root() . str_replace(JPATH_ROOT, '', COMMUNITY_PATH_ASSETS) . "{$td_path}.png";
     }
     if (file_exists(COMMUNITY_PATH_ASSETS . $td_path . '.jpg')) {
         return JUri::root() . str_replace(JPATH_ROOT, '', COMMUNITY_PATH_ASSETS) . "{$td_path}.jpg";
     }
     if ($gender == 'undefined') {
         $gender = 'male';
     }
     $thumb = CUrlHelper::avatarURI($this->_thumb, 'user-' . ucfirst($gender) . '-thumb.png');
     return $thumb;
 }