utils

package
v0.0.0-...-34c3de1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrHashInvalid string = "ERR_HASH_INVALID"
)

Variables

This section is empty.

Functions

func GetRid

func GetRid(ver, appID, hash string) string

func HashToRid

func HashToRid(appID, hash string) string

func IdToRid

func IdToRid(appID, id string) string

func MMHash

func MMHash(buf []byte) uint64

func ResizeBytesImgToBytes

func ResizeBytesImgToBytes(srcBytes []byte, filename string, width, height int, enlargeSmaller bool, quality int) (imgBytes []byte, err error)

func ResizeFileToFile

func ResizeFileToFile(src string, dst string, width int, height int, enlargeSmaller bool, quality int) error

func ResizeImg

func ResizeImg(srcImg image.Image, width, height int, enlargeSmaller bool) (newImg image.Image)

func ResizeImgToBytes

func ResizeImgToBytes(srcImg image.Image, filename string, width, height int, enlargeSmaller bool, quality int) (imgBytes []byte, err error)

func ResizeSmaller

func ResizeSmaller(srcWidth, srcHeight, width, height int) (newWidth int, newHeight int)

* src size: 160x90 input size: 200x300, output: 60x90 input size: 200x100, output: 160x80 *

Types

type CropParams

type CropParams struct {
	Width          int
	Height         int
	EnlargeSmaller bool
}

func ParseImageProcessParams

func ParseImageProcessParams(imageProcess string) (quality int, crop *CropParams)

ParseImageProcessParams 解析参数. resize,fw_300,fh_200/quality,q_80

type Size

type Size struct {
	Width, Height int
}

func GetImageSize

func GetImageSize(imgContent []byte) (*Size, error)

func GetImageSizeF

func GetImageSizeF(path string) (*Size, error)

Jump to

Keyboard shortcuts

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