image

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ActionSep is separator of action.
	ActionSep = ":"

	// OPSep is separator of operation.
	OPSep = "|"

	// KVSep is separator of Key-Value.
	KVSep = "_"

	//KVPairSep is separator of args.
	KVPairSep = ","
)
View Source
const (
	// InfoOperation is string of info operation.
	InfoOperation string = "info"

	// CropOperation is string of crop operation.
	CropOperation string = "crop"

	// FormatOperation is string of format operation.
	FormatOperation string = "format"

	// ResizeOperation is string of resize operation.
	ResizeOperation string = "resize"

	// RotateOperation is string of rotate operation.
	RotateOperation string = "rotate"

	// WaterMarkOperation is string of watermark operation.
	WaterMarkOperation string = "watermark"

	// WaterMarkImageOperation is string of watermark image operation.
	WaterMarkImageOperation string = "watermark_image"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CropGravity

type CropGravity int

CropGravity is the type of crop gravity.

const (

	// CropCenter crops image to center width and height.
	CropCenter CropGravity = iota

	// CropNorth crops image to north width and height.
	CropNorth

	// CropEast crops image to east width and height.
	CropEast

	// CropSouth crops image to south width and height.
	CropSouth

	// CropWest crops image to west width and height.
	CropWest

	// CropNorthWest crops image to north west width and height.
	CropNorthWest

	// CropNorthEast crops image to north east width and height.
	CropNorthEast

	// CropSouthWest crops image to south west width and height.
	CropSouthWest

	// CropSouthEast crops image to south east width and height.
	CropSouthEast

	// CropAuto crops image to auto width and height.
	CropAuto
)

type CropParam

type CropParam struct {
	Width   int         `schema:"w,omitempty"`
	Height  int         `schema:"h,omitempty"`
	Gravity CropGravity `schema:"g"`
}

CropParam is param of the crop operation.

type FormatParam

type FormatParam struct {
	Type string `schema:"t"`
}

FormatParam is param of the format operation.

type Image

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

Image is struct of Image process.

func Init

func Init(bucket *service.Bucket, objectKey string) *Image

Init initializes an image to process.

func (*Image) Crop

func (image *Image) Crop(param *CropParam) *Image

Crop image.

func (*Image) Format

func (image *Image) Format(param *FormatParam) *Image

Format image.

func (*Image) Info

func (image *Image) Info() *Image

Info gets the information of the image.

func (*Image) Process

func (image *Image) Process() (*service.ImageProcessOutput, error)

Process does Image process.

func (*Image) Resize

func (image *Image) Resize(param *ResizeParam) *Image

Resize image.

func (*Image) Rotate

func (image *Image) Rotate(param *RotateParam) *Image

Rotate image.

func (*Image) WaterMark

func (image *Image) WaterMark(param *WaterMarkParam) *Image

WaterMark is operation of watermark text content.

func (*Image) WaterMarkImage

func (image *Image) WaterMarkImage(param *WaterMarkImageParam) *Image

WaterMarkImage is operation of watermark image.

type ResizeMode

type ResizeMode int

ResizeMode is the type of resize mode.

const (
	// ResizeFixed resizes image to fix  width and height.
	ResizeFixed ResizeMode = iota

	// ResizeForce resizes image to force witdth and height.
	ResizeForce

	// ResizeThumbnail resizes image to thumbnail width and height.
	ResizeThumbnail
)

type ResizeParam

type ResizeParam struct {
	Width  int        `schema:"w,omitempty"`
	Height int        `schema:"h,omitempty"`
	Mode   ResizeMode `schema:"m"`
}

ResizeParam is param of the resize operation.

type RotateParam

type RotateParam struct {
	Angle int `schema:"a"`
}

RotateParam is param of the rotate operation.

type WaterMarkImageParam

type WaterMarkImageParam struct {
	Left    int     `schema:"l"`
	Top     int     `schema:"t"`
	Opacity float64 `schema:"p,omitempty"`
	URL     string  `schema:"u"`
}

WaterMarkImageParam is param of the waterMark image operation

type WaterMarkParam

type WaterMarkParam struct {
	Dpi     int     `schema:"d,omitempty"`
	Opacity float64 `schema:"p,omitempty"`
	Text    string  `schema:"t"`
	Color   string  `schema:"c"`
}

WaterMarkParam is param of the wartermark operation.

Jump to

Keyboard shortcuts

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