コード例 #1
0
 /**
  * render the change avatar popup
  */
 public function onAvatar()
 {
     $avatars = [];
     $themePath = UserLogin::getThemeDir();
     $avatarPath = $themePath . '/assets/images/avatars/*.jpg';
     // loop through all the files in the plugin's avatars directory and parse the file names
     foreach (glob($avatarPath) as $file) {
         $path = str_replace(base_path(), '', $file);
         $avatars[] = ['path' => $path, 'basename' => basename($path)];
     }
     $user = Auth::getUser();
     return $this->renderPartial('@modalDisplay', ['title' => 'Select an avatar', 'content' => $this->renderPartial('@avatars', ['avatars' => $avatars, 'userAvatar' => $user->avatar->file_name])]);
 }
コード例 #2
0
ファイル: UserLogin.php プロジェクト: janusnic/OctoberFriends
 public function getAvatars()
 {
     $avatars = [];
     $themePath = UserLogin::getThemeDir();
     $avatarPath = $themePath . '/assets/images/avatars/*.jpg';
     // loop through all the files in the plugin's avatars directory and parse the file names
     foreach (glob($avatarPath) as $file) {
         $path = str_replace(base_path(), '', $file);
         $avatars[] = $path;
     }
     return $this->renderPartial('@avatars', ['avatars' => $avatars]);
 }