img

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImageUtils added in v1.1.0

type ImageUtils struct{}

func NewImgUtils added in v1.1.0

func NewImgUtils() *ImageUtils

func (*ImageUtils) GetInfo added in v1.1.0

func (i *ImageUtils) GetInfo(path string, withMd5 bool) (*Info, error)

func (*ImageUtils) Resize added in v1.1.0

func (i *ImageUtils) Resize(ro ResizeOptions) error

Resize 根据提供的 ResizeOptions 调整图像大小

func (*ImageUtils) ToBase64 added in v1.1.0

func (i *ImageUtils) ToBase64(imgPath string) (string, error)

func (*ImageUtils) WriteBase64ToFile added in v1.1.0

func (i *ImageUtils) WriteBase64ToFile(base64Str, fullPath string, overwrite bool) error

WriteBase64ToFile 将Base64编码的图片字符串写入文件

type Info

type Info struct {
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	Format   string `json:"format"`
	Ext      string `json:"ext"`
	Size     int64  `json:"size"`
	FileName string `json:"filename"`
	FileMD5  string `json:"file_md5"`
}

type ResizeOptions

type ResizeOptions struct {
	Src      string
	SavePath string
	Width    int
	Height   int
	Quality  int
}

ResizeOptions 定义了 Resize 方法的参数

Jump to

Keyboard shortcuts

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