Add numeric avatars

This commit is contained in:
Matt Baer 2019-01-07 15:40:37 -05:00
parent 2942a6818e
commit c2a7f19ef0
11 changed files with 2 additions and 2 deletions

View File

@ -262,7 +262,7 @@ func (c *Collection) ForPublic() {
c.URL = c.CanonicalURL()
}
var isLowerLetter = regexp.MustCompile("[a-z]").MatchString
var isAvatarChar = regexp.MustCompile("[a-z0-9]").MatchString
func (c *Collection) PersonObject(ids ...int64) *activitystreams.Person {
accountRoot := c.FederatedAccount()
@ -297,7 +297,7 @@ func (c *Collection) PersonObject(ids ...int64) *activitystreams.Person {
func (c *Collection) AvatarURL() string {
fl := string(unicode.ToLower([]rune(c.DisplayTitle())[0]))
if !isLowerLetter(fl) {
if !isAvatarChar(fl) {
return ""
}
return hostName + "/img/avatars/" + fl + ".png"

BIN
static/img/avatars/0.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
static/img/avatars/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
static/img/avatars/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
static/img/avatars/3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

BIN
static/img/avatars/4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
static/img/avatars/5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
static/img/avatars/6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
static/img/avatars/7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
static/img/avatars/8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
static/img/avatars/9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB