コード例 #1
0
ファイル: WindidUserService.php プロジェクト: ccq18/EduSoho
 public 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('RES:') . 'images/face/';
     $store = Wind::getComponent('storage');
     $fileDir = 'avatar/' . Pw::getUserDir($uid) . '/';
     foreach ($_avatar as $des => $org) {
         $toPath = $store->getAbsolutePath($uid . $des, $fileDir);
         $fromPath = $defaultBanDir . $type . $org;
         PwUpload::createFolder(dirname($toPath));
         PwUpload::copyFile($fromPath, $toPath);
         $store->save($toPath, $fileDir . $uid . $des);
     }
     return true;
 }
コード例 #2
0
ファイル: IndexController.php プロジェクト: sanzhumu/nextwind
 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;
 }