avatar

package
v0.0.0-...-6cbe0e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Initials

type Initials interface {
	// Generate will create a new avatar with the given initials and color.
	Generate(initials, color string) ([]byte, error)
	ContentType() string
}

Initials is able to generate initial avatar.

type Options

type Options int

Options can be used to give options for the generated image

const (

	// GreyBackground is an option to force a grey background
	GreyBackground Options = 1 + iota
)

type PNGInitials

type PNGInitials struct {
	// contains filtered or unexported fields
}

PNGInitials create PNG avatars with initials in it.

This implementation is based on the `convert` binary.

func NewPNGInitials

func NewPNGInitials(cmd string) *PNGInitials

NewPNGInitials instantiate a new PNGInitials.

func (*PNGInitials) ContentType

func (a *PNGInitials) ContentType() string

ContentType return the generated avatar content-type.

func (*PNGInitials) Generate

func (a *PNGInitials) Generate(initials, color string) ([]byte, error)

Generate will create a new avatar with the given initials and color.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service handle all the interactions with the initials images.

func NewService

func NewService(cache cache.Cache, cmd string) *Service

NewService instantiate a new Service.

func (*Service) GenerateInitials

func (s *Service) GenerateInitials(publicName string, opts ...Options) ([]byte, string, error)

GenerateInitials an image with the initials for the given name (and the content-type to use for the HTTP response).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL