Version: v0.0.0-...-875c96e Latest Latest

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 9 Imported by: 0



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



This section is empty.


This section is empty.


This section is empty.


type Namer

type Namer func(string, int) 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 Style

type Style int

Desired thumbnailing styles.

const (
	Fit Style = iota

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) error

func (*Thumbnail) Name

func (*Thumbnail) Name() string

func (*Thumbnail) Namer

func (self *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 (self *Thumbnail) Process(context *goldsmith.Context, inputFile *goldsmith.File) error

func (*Thumbnail) Size

func (self *Thumbnail) Size(dims int) *Thumbnail

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

func (*Thumbnail) Style

func (self *Thumbnail) Style(style Style) *Thumbnail

Style sets the desired thumbnailing style.

Source Files

Jump to

Keyboard shortcuts

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