Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder interface { // Encode encodes the image to a format. Encode(io.Writer, image.Image) error // Types returns the formats suffixes. Types() []string // MimeType returns the mimetype used by the encoder. MimeType() string }
Encoder encodes the thumbnail to a specific format.
func EncoderForType ¶
EncoderForType returns the encoder for a given file type or nil if the type is not supported.
type JpegEncoder ¶
type JpegEncoder struct{}
JpegEncoder encodes to jpg.
func (JpegEncoder) MimeType ¶
func (e JpegEncoder) MimeType() string
MimeType returns the mimetype for jpg files.
type Manager ¶
type Manager interface { // Get will return a thumbnail for a file Get(Request, image.Image) ([]byte, error) // GetStored loads the thumbnail from the storage. // It will return nil if no image is stored for the given context. GetStored(Request) []byte }
Manager is responsible for generating thumbnails
type PngEncoder ¶
type PngEncoder struct{}
PngEncoder encodes to png
func (PngEncoder) MimeType ¶
func (e PngEncoder) MimeType() string
MimeType returns the mimetype for png files.
type Request ¶
type Request struct { Resolution resolution.Resolution ImagePath string Encoder Encoder ETag string Username string }
Request bundles information needed to generate a thumbnail for afile
type SimpleManager ¶
type SimpleManager struct {
// contains filtered or unexported fields
}
SimpleManager is a simple implementation of Manager
func NewSimpleManager ¶
func NewSimpleManager(storage storage.Storage, logger log.Logger) SimpleManager
NewSimpleManager creates a new instance of SimpleManager
func (SimpleManager) GetStored ¶
func (s SimpleManager) GetStored(r Request) []byte
GetStored tries to get the stored thumbnail and return it. If there is no cached thumbnail it will return nil
Click to show internal directories.
Click to hide internal directories.