Ejemplo n.º 1
0
 /**
  * 获取用户头像
  * @param $uid
  * @param $size big middle small
  * @return string
  */
 public function getAvatar()
 {
     $uid = $this->getInput('uid');
     $size = $this->getInput('size');
     $file = $uid . (in_array($size, array('middle', 'small')) ? '_' . $size : '') . '.jpg';
     return $this->attachUrl . 'avatar/' . Windid::getUserDir($uid) . '/' . $file;
 }
Ejemplo n.º 2
0
 /**
  * 获取用户头像
  * @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/' . Windid::getUserDir($uid) . '/' . $file;
     $this->output($result);
 }
Ejemplo n.º 3
0
 public function defaultAvatar($uid, $type = 'face')
 {
     Wind::import('WINDID:service.upload.WindidUpload');
     $_avatar = array('.jpg' => '_big.jpg', '_middle.jpg' => '_middle.jpg', '_small.jpg' => '_small.jpg');
     $defaultBanDir = Wind::getRealDir('PUBLIC:') . 'res/images/face/';
     Wind::import('WINDID:service.config.srv.WindidStoreService');
     $srv = new WindidStoreService();
     $store = $srv->getStore();
     $fileDir = '/avatar/' . Windid::getUserDir($uid) . '/';
     foreach ($_avatar as $des => $org) {
         $toPath = $store->getAbsolutePath($uid . $des, $fileDir);
         $fromPath = $defaultBanDir . $type . $org;
         WindidUpload::createFolder(dirname($toPath));
         WindidUpload::copyFile($fromPath, $toPath);
         $store->save($toPath, $fileDir . $uid . $des);
     }
     return true;
 }
Ejemplo n.º 4
0
 /**
  * 获取用户头像
  * @param $uid
  * @param $size big middle small
  * @return string
  */
 public function getAvatar($uid, $size = 'middle')
 {
     $file = $uid . (in_array($size, array('middle', 'small')) ? '_' . $size : '') . '.jpg';
     return $this->attachUrl . '/avatar/' . Windid::getUserDir($uid) . '/' . $file;
 }
Ejemplo n.º 5
0
 public function __construct($uid)
 {
     $this->ftype = array('jpg' => 2000, 'png' => 2000, 'jpeg' => 2000);
     $this->uid = $uid;
     $this->udir = Windid::getUserDir($this->uid);
 }