img

package
v0.0.0-...-ccdf126 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JpegOptions = jpeg.Options{Quality: 75}

Functions

func GetImage

func GetImage(fpath string, decodeFormat string, scalePercentage int) (image.Image, error)

func ReduceSize

func ReduceSize(fullpath string, size int64, width, height uint) error

减小文件尺寸大小

func Resize

func Resize(width, height uint, src io.Reader, dst io.Writer) error

func Thumbnail

func Thumbnail(maxWidth, maxHeight uint, src io.Reader, dst io.Writer) error

生成缩略图的方法

func ThumbnailFile

func ThumbnailFile(maxWidth, maxHeight uint, src, dst string, overwrite bool) error

func ThumbnailImage

func ThumbnailImage(maxWidth, maxHeight uint, src image.Image) image.Image

func ThumbnailImageToFile

func ThumbnailImageToFile(maxWidth, maxHeight uint, src image.Image, dst string, format string, overwrite bool) error

func WriteJpegFile

func WriteJpegFile(i image.Image, fpath string, quality int, overwrite bool) error

Types

type Image

type Image struct {
	ImageId int64 `db:"imageid"`
	//	UniqueId   string
	UploadTime time.Time
	Size       int64
	Width      int
	Height     int
	Format     string
	//	Path       string
	Basename string // userId_

	UserId      int64
	StoragePath string `json:"-"`
	StorageId1  string // 目前使用的远程存储是哪个
	StorageId2  string
	StorageId3  string
}

Jump to

Keyboard shortcuts

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