thumbnail

package
v0.0.0-...-72c21ce Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
	Crop
	Pad
)

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.

Jump to

Keyboard shortcuts

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