resize

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resize

type Resize struct {
	Width  string `json:"width,omitempty"`
	Height string `json:"height,omitempty"`
}

Resize can downsize images. If upsizing of an image is detected, nothing will be done and the input image is returned unchanged.

func (Resize) Apply

func (f Resize) Apply(repl *caddy.Replacer, img image.Image) (image.Image, error)

Apply applies the image filter to an image and returns the new image.

type ResizeFactory

type ResizeFactory struct{}

ResizeFactory creates Resize instances.

func (ResizeFactory) Name

func (ff ResizeFactory) Name() string

Name returns the name of the filter, which is also the directive used in the image filter block.

func (ResizeFactory) New

func (ff ResizeFactory) New(args ...string) (imagefilter.Filter, error)

New initialises and returns a ResizeFilter instance.

Syntax:

resize <width> <height>

Parameters:

width must be a positive integer and determines the maximum width.

height must be a positive integer and determines the maximum height.

Either width or height can be 0, then the image aspect ratio is preserved.

func (ResizeFactory) Unmarshal

func (ff ResizeFactory) Unmarshal(data []byte) (imagefilter.Filter, error)

Unmarshal decodes JSON data and returns a Resize instance.

Jump to

Keyboard shortcuts

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