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


PHP Pw::getUserDir方法代码示例

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


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

示例1: __construct

 public function __construct($uid)
 {
     $this->ftype = array('jpg' => 2000, 'png' => 2000, 'jpeg' => 2000);
     $this->mime = array('image/jpeg', 'image/png', 'image/jpg');
     $this->uid = $uid;
     $this->udir = Pw::getUserDir($this->uid);
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:7,代码来源:WindidAvatarUpload.php

示例2: __construct

 public function __construct(PwUserBo $user)
 {
     $this->ftype = array('jpg' => 2000, 'png' => 2000, 'jpeg' => 2000);
     $this->user = $user;
     $this->udir = Pw::getUserDir($this->user->uid);
     $this->mime = array('image/jpg', 'image/jpeg', 'image/png', 'image/gif');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:7,代码来源:PwAvatarUpload.php

示例3: getAction

 /**
  * 获取用户头像
  *
  * @param $uid
  * @param $size big middle small
  * @return string
  */
 public function getAction()
 {
     $uid = $this->getInput('uid', 'get');
     $size = $this->getInput('size', 'get');
     !$size && ($size = 'middle');
     $file = $uid . (in_array($size, array('middle', 'small')) ? '_' . $size : '') . '.jpg';
     $result = $this->attachUrl . '/avatar/' . Pw::getUserDir($uid) . '/' . $file;
     $this->output($result);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:16,代码来源:AvatarController.php

示例4: avatarAction

 /**
  * 头像转移
  */
 public function avatarAction()
 {
     $end_uid = $this->getMaxUid();
     ini_set('max_execution_time', 0);
     $time_start = microtime(true);
     list($ftp, $attachDir) = $this->_getFtp();
     $defauleDir = rtrim(Wind::getRealDir('PUBLIC:res.images.face', true), '/');
     list($start_uid, $end) = $this->_getStartAndLimit(intval($this->getInput('uid', 'get')), $end_uid, $ftp ? true : false);
     while ($start_uid < $end) {
         $res = $this->_getOldAvatarPath($attachDir, $start_uid);
         $big = $res['big'];
         $middle = $res['middle'];
         $small = $res['small'];
         if (!$this->checkFile($middle)) {
             $big = $defauleDir . '/face_big.jpg';
             $middle = $defauleDir . '/face_middle.jpg';
             $small = $defauleDir . '/face_small.jpg';
         }
         $_toPath = '/avatar/' . Pw::getUserDir($start_uid) . '/';
         $to_big = $_toPath . $start_uid . '.jpg';
         $to_middle = $_toPath . $start_uid . '_middle.jpg';
         $to_small = $_toPath . $start_uid . '_small.jpg';
         if ($ftp) {
             $ftp->mkdirs($_toPath);
             $ftp->upload($big, $to_big);
             $ftp->upload($middle, $to_middle);
             $ftp->upload($small, $to_small);
         } else {
             WindFolder::mkRecur($attachDir . $_toPath);
             copy($big, $attachDir . $to_big);
             copy($middle, $attachDir . $to_middle);
             copy($small, $attachDir . $to_small);
         }
         $start_uid++;
     }
     if ($end < $end_uid) {
         $this->setOutput($end, 'uid');
         $this->setOutput($this->getInput('token', 'get'), 'token');
         $this->setTemplate('upgrade_avatar');
     } else {
         $this->showMessage('升级成功!');
     }
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:46,代码来源:UpgradeController.php

示例5: getAvatar

 public function getAvatar($uid, $size = 'middle')
 {
     $file = $uid . (in_array($size, array('middle', 'small')) ? '_' . $size : '') . '.jpg';
     return Wekit::app('windid')->config->site->avatarUrl . '/avatar/' . Pw::getUserDir($uid) . '/' . $file;
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:5,代码来源:WindidUserService.php

示例6: restore_avatar

 /**
  * 初始化用户头像
  * @param int $uid
  * @param string $url 腾讯头像地址
  */
 function restore_avatar($uid, $url)
 {
     $store = Wind::getComponent('storage');
     Wind::import('SRV:upload.PwUpload');
     Wind::import('LIB:image.PwImage');
     $fileDir = sprintf('avatar/%s/', Pw::getUserDir($uid));
     $_avatar = array('.jpg' => 200, '_middle.jpg' => 120, '_small.jpg' => 50);
     $file = tempnam(sys_get_temp_dir(), 'avatar');
     $img = httpget($url);
     file_put_contents($file, $img);
     $img = new PwImage($file);
     $thumb = new PwImageThumb($img);
     foreach ($_avatar as $des => $size) {
         $toPath = $store->getAbsolutePath($uid . $des, $fileDir);
         PwUpload::createFolder(dirname($toPath));
         if ($size < 100) {
             $thumb->setWidth($size);
             $thumb->setHeight($size);
             $thumb->setDstFile($toPath);
             $thumb->execute();
         } else {
             copy($file, $toPath);
         }
     }
     Wind::import('SRV:upload.action.PwAvatarUpload');
     Wind::import('SRV:upload.PwUpload');
     PwSimpleHook::getInstance('update_avatar')->runDo($uid);
     @unlink($file);
     return true;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:35,代码来源:qq_oauth2.php

示例7: _defaultAvatar

 private function _defaultAvatar($uid, $type = 'face')
 {
     Wind::import('LIB:upload.PwUpload');
     $_avatar = array('.jpg' => '_big.jpg', '_middle.jpg' => '_middle.jpg', '_small.jpg' => '_small.jpg');
     $defaultBanDir = Wind::getRealDir('ROOT:') . 'res/images/face/';
     $fileDir = 'avatar/' . Pw::getUserDir($uid) . '/';
     $attachPath = Wind::getRealDir('ROOT:') . 'windid/attachment/';
     foreach ($_avatar as $des => $org) {
         $toPath = $attachPath . $fileDir . $uid . $des;
         $fromPath = $defaultBanDir . $type . $org;
         PwUpload::createFolder(dirname($toPath));
         PwUpload::copyFile($fromPath, $toPath);
     }
     return true;
 }
开发者ID:sanzhumu,项目名称:nextwind,代码行数:15,代码来源:IndexController.php


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