thumb

package
v0.0.0-...-b6fbd03 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Size is max width or height of the thumbnail image
	Size uint = 256
	// Quality is the thumbnail jpeg quality
	Quality int = 90
)
View Source
var Font, _ = freetype.ParseFont(fontBytes)

Font - Bitstream Vera

Functions

This section is empty.

Types

type Thumbnail

type Thumbnail struct {
	Data   []byte          `json:"data"`
	MIME   string          `json:"mime"`
	Bounds image.Rectangle `json:"bounds"`
}

Thumbnail contains a thumbnail image in bytes + the MIME type and bounds

func Get

func Get(img io.Reader, label string) (*Thumbnail, error)

Get reads an image from an io.Reader and returns the thumbnail

func GetFromURL

func GetFromURL(ctx context.Context, url, label string) (*Thumbnail, error)

GetFromURL downloads the image at the given URL and returns the thumbnail

func (Thumbnail) ServeHTTP

func (t Thumbnail) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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