예제 #1
0
 private function getAvatar($user_name)
 {
     if (!$this->checkIfAvatarIsDownloaded($user_name)) {
         $folder_path = $this->wikiName;
         if (!is_dir($folder_path)) {
             mkdir($folder_path, 0700);
         }
         $folder_path = $folder_path . '/avatars';
         if (!is_dir($folder_path)) {
             mkdir($folder_path, 0700);
         }
         $file_path = $folder_path . '/' . $user_name . '.png';
         if (!file_exists($file_path)) {
             $avatar = AvatarService::getAvatarurl($user_name, 50);
             file_put_contents($file_path, Http::get($avatar));
             $this->downloadedAvatars[$user_name] = true;
         }
     }
 }