file

package
v1.30.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsTransparent added in v1.20.1

func ContainsTransparent(img image.Image) bool

judge png contains transparent

func GetFileContentType added in v1.20.1

func GetFileContentType(buffer []byte) string

file byte data[:512] image type: "image/jpeg","image/png"

func GetImageType added in v1.20.1

func GetImageType(buffer []byte) string

jpeg,png

func PngToJpeg added in v1.20.1

func PngToJpeg(img image.Image, jpegF io.Writer, quality int) error

png to jpeg quality: -1 noting

Types

type File

type File struct {
	// file name
	Name string
	// path
	Path    string
	NewPath string
	// img attributes
	Width  int
	Height int

	// format 2006-01-02 15:04:05
	Format string

	IsComp  int8 // is img compress
	Quality int  // default 80, 1-100
}

file

func (*File) CompressImage

func (f *File) CompressImage(imageType string) error

图片压缩

func (*File) GetUploadFile

func (f *File) GetUploadFile(file *multipart.FileHeader) (filename string, err error)

获得文件上传路径

func (*File) SaveUploadedFile

func (f *File) SaveUploadedFile(file *multipart.FileHeader, filename string) (path string, err error)

save file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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