Handle both WebP and original avatars
This commit is contained in:
parent
e07a865d9c
commit
688c09760b
26
main.go
26
main.go
@ -92,8 +92,17 @@ func main() {
|
||||
return ctx.File("images/avatars/large/webp/" + user.ID + ".webp")
|
||||
}
|
||||
|
||||
err = errors.New("Your browser doesn't support the WebP image format")
|
||||
return ctx.Error(http.StatusBadRequest, err.Error(), err)
|
||||
original := arn.FindFileWithExtension(
|
||||
user.ID,
|
||||
"images/avatars/large/original/",
|
||||
arn.OriginalImageExtensions,
|
||||
)
|
||||
|
||||
if original == "" {
|
||||
return ctx.Error(http.StatusNotFound, "Avatar not found", errors.New("Image not found for user: "+user.ID))
|
||||
}
|
||||
|
||||
return ctx.File(original)
|
||||
})
|
||||
|
||||
// Avatars
|
||||
@ -109,8 +118,17 @@ func main() {
|
||||
return ctx.File("images/avatars/small/webp/" + user.ID + ".webp")
|
||||
}
|
||||
|
||||
err = errors.New("Your browser doesn't support the WebP image format")
|
||||
return ctx.Error(http.StatusBadRequest, err.Error(), err)
|
||||
original := arn.FindFileWithExtension(
|
||||
user.ID,
|
||||
"images/avatars/small/original/",
|
||||
arn.OriginalImageExtensions,
|
||||
)
|
||||
|
||||
if original == "" {
|
||||
return ctx.Error(http.StatusNotFound, "Avatar not found", errors.New("Image not found for user: "+user.ID))
|
||||
}
|
||||
|
||||
return ctx.File(original)
|
||||
})
|
||||
|
||||
// Elements
|
||||
|
@ -4,6 +4,7 @@
|
||||
height avatar-size
|
||||
border-radius 100%
|
||||
object-fit cover
|
||||
opacity 0
|
||||
default-transition
|
||||
:hover
|
||||
box-shadow outline-shadow-heavy
|
Loading…
Reference in New Issue
Block a user