Back to

Package thumbnail

Latest Go to latest

The latest major version is .

Published: Aug 14, 2020 | License: MIT | Module:


Package thumbnail automatically generates thumbnails for a variety of common image formats and saves them to a user-configurable path.


type Namer

type Namer func(string, uint) string

Namer callback function builds thumbnail file paths based on the original file path. An empty path can be returned if a thumbnail should not be generated for the current file.

type Thumbnail

type Thumbnail struct {
	// contains filtered or unexported fields

Thumbnail chainable context.

func New

func New() *Thumbnail

New creates a new instance of the Thumbnail plugin.

func (*Thumbnail) Initialize

func (*Thumbnail) Initialize(context *goldsmith.Context) (goldsmith.Filter, error)

func (*Thumbnail) Name

func (*Thumbnail) Name() string

func (*Thumbnail) Namer

func (plugin *Thumbnail) Namer(namer Namer) *Thumbnail

Namer sets the callback used to build paths for thumbnail files. Default naming appends "-thumb" to the path and changes extension to PNG, for example "file.jpg" becomes "file-thumb.png".

func (*Thumbnail) Process

func (plugin *Thumbnail) Process(context *goldsmith.Context, inputFile *goldsmith.File) error

func (*Thumbnail) Size

func (plugin *Thumbnail) Size(dims uint) *Thumbnail

Size sets the desired maximum pixel size of generated thumbnails (default: 128).

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier