当前位置: 首页>>代码示例>>PHP>>正文


PHP CUrlHelper::avatarURI方法代码示例

本文整理汇总了PHP中CUrlHelper::avatarURI方法的典型用法代码示例。如果您正苦于以下问题:PHP CUrlHelper::avatarURI方法的具体用法?PHP CUrlHelper::avatarURI怎么用?PHP CUrlHelper::avatarURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CUrlHelper的用法示例。


在下文中一共展示了CUrlHelper::avatarURI方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getLargeAvatar

 /**
  * 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();
     }
 }
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:15,代码来源:profile.php

示例2: getAvatar

 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;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:14,代码来源:profile.php

示例3: getAvatar

 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;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:18,代码来源:profile.php

示例4: changeAvatar


//.........这里部分代码省略.........
             /**
              * 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'));
     }
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:101,代码来源:photos.php

示例5: getThumbAvatar

 /**
  * @deprecated Since 2.0
  */
 public function getThumbAvatar($id, $thumb)
 {
     $thumb = CUrlHelper::avatarURI($thumb, 'event_thumb.png');
     return $thumb;
 }
开发者ID:SMARTRESPONSOR,项目名称:SMARTRESPONSOR,代码行数:8,代码来源:events.php

示例6: getThumbAvatar

 /**
  * 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;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:13,代码来源:event.php

示例7: getThumbAvatar

 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;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:14,代码来源:group.php

示例8: getThumbAvatar

 /**
  * @deprecated Since 2.0
  */
 function getThumbAvatar($id, $thumb)
 {
     CFactory::load('helpers', 'url');
     $thumb = CUrlHelper::avatarURI($thumb, 'event_thumb.png');
     return $thumb;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:9,代码来源:events.php

示例9: getThumbAvatar

 /**
  * 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;
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:30,代码来源:user.php

示例10: getThumbAvatar

 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;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:10,代码来源:view.html.php

示例11: changeAvatar

 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'));
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:53,代码来源:photos.php

示例12: getThumbAvatar

 /**
  * 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;
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:46,代码来源:user.php


注:本文中的CUrlHelper::avatarURI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。