Documentation ¶
Index ¶
- Constants
- func BrandPath(brand Brandable, userID uint, filename string) string
- func BrandUrls(ctx echo.Context, brand Brandable, userID uint, filename string) map[string]string
- func DeleteImage(brand Brandable, userID uint, filename string) error
- func DeleteUserAvatar(userID uint) (*database.User, error)
- func UploadImage(brand Brandable, userID uint, mediaType string, reader io.Reader) (string, error)
- type Brandable
- type UserAvatar
- type UserCover
Constants ¶
View Source
const ( UserAvatarBrandType = "user-avatar" UserCoverBrandType = "user-cover" )
avatar brand type list
Variables ¶
This section is empty.
Functions ¶
func DeleteImage ¶
DeleteImage delete image file
func DeleteUserAvatar ¶
DeleteUserAvatar delete user avatar and reset to default avatar
Types ¶
type Brandable ¶
type Brandable interface { // e.g: user-avatar, user-cover, topic-cover BrandType() string // e.g: // // { // 'small': [width number, height number], // 'middle': [width number, height number], // 'large': [width number, height number] // } BrandSize() map[string][2]int // e.g: {'original': 'url', 'size string': 'url'} DefaultBrandUrls() map[string]string }
Brandable object logo e.g: user-avatar, user-cover, topic-cover
type UserAvatar ¶
type UserAvatar struct{}
UserAvatar impl avatar.Brandable for user avatar
func (*UserAvatar) BrandSize ¶
func (u *UserAvatar) BrandSize() map[string][2]int
BrandSize user avatar size
func (*UserAvatar) DefaultBrandUrls ¶
func (u *UserAvatar) DefaultBrandUrls() map[string]string
DefaultBrandUrls default user avatar
Click to show internal directories.
Click to hide internal directories.