thumb

package
v1.4.16 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resize

func Resize(newWidth, newHeight uint, img image.Image) image.Image

func Thumbnail

func Thumbnail(maxWidth, maxHeight uint, img image.Image) image.Image

Thumbnail will downscale provided image to max width and height preserving original aspect ratio and using the interpolation function interp. It will return original image, without processing it, if original sizes are already smaller than provided constraints.

Types

type Thumb

type Thumb struct {
	// contains filtered or unexported fields
}

Thumb 缩略图

func NewThumbFromFile

func NewThumbFromFile(file io.Reader, name string) (*Thumb, error)

NewThumbFromFile 从文件数据获取新的Thumb对象, 尝试通过文件名name解码图像

func (*Thumb) CreateAvatar

func (image *Thumb) CreateAvatar(uid uint) error

CreateAvatar 创建头像

func (*Thumb) GetSize

func (image *Thumb) GetSize() (int, int)

GetSize 获取图像尺寸

func (*Thumb) GetThumb

func (image *Thumb) GetThumb(width, height uint)

GetThumb 生成给定最大尺寸的缩略图

func (*Thumb) Save

func (image *Thumb) Save(path string) (err error)

Save 保存图像到给定路径

Jump to

Keyboard shortcuts

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