public function setAvatar($filepath)
    {
        if (! file_exists($filepath)) {
            throw new FileNotFoundException("File does not exist at path {$filepath}.");
        }

        $extension = pathinfo($filepath, PATHINFO_EXTENSION);
        $file      = file_get_contents($filepath);
        $base64    = base64_encode($file);

        $this->attributes['avatarhash'] = "data:image/{$extension};base64,{$base64}";

        return true;
    }
public function setAvatar($filepath)
    {
        if (! file_exists($filepath)) {
            throw new FileNotFoundException("File does not exist at path {$filepath}.");
        }

        $extension = pathinfo($filepath, PATHINFO_EXTENSION);
        $file      = file_get_contents($filepath);
        $base64    = base64_encode($file);

        $this->attributes['avatarhash'] = "data:image/{$extension};base64,{$base64}";

        return true;
    }
public function setAvatar ( $ filepath ) { if ( ! file_exists ( $ filepath ) ) { throw new FileNotFoundException ( "File does not exist at path {$filepath}." ) ; } $ extension = pathinfo ( $ filepath , PATHINFO_EXTENSION ) ; $ file = file_get_contents ( $ filepath ) ; $ base64 = base64_encode ( $ file ) ; $ this -> attributes [ 'avatarhash' ] = "data:image/{$extension};base64,{$base64}" ; return true ; }
Sets the users avatar.

@param string $filepath The path to the file.

@throws \Discord\Exceptions\FileNotFoundException Thrown when the file does not exist.

@return bool Whether the setting succeeded or failed.
Sets the users avatar .