thumbnail

package
v0.0.0-...-35b844d Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultThumbnailServicePlugin = &ThumbnailServicePlugin{}

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Process   map[string]ThumbnailProcess
	UseEngine string
}

func NewEngine

func NewEngine() *Engine

func (*Engine) OnInit

func (t *Engine) OnInit(e *harukap.HarukaAppEngine) error

func (*Engine) Resize

func (t *Engine) Resize(ctx context.Context, input io.ReadCloser, option ThumbnailOption) (io.ReadCloser, error)

type LocalThumbnailProcess

type LocalThumbnailProcess struct {
}

func (*LocalThumbnailProcess) Resize

type ThumbnailClient

type ThumbnailClient struct {
	BaseUrl string
}

func NewThumbnailClient

func NewThumbnailClient(baseUrl string) *ThumbnailClient

func (*ThumbnailClient) Check

func (c *ThumbnailClient) Check() error

func (*ThumbnailClient) Generate

func (c *ThumbnailClient) Generate(sourcePath string, output string, option ThumbnailOption) error

func (*ThumbnailClient) GenerateAsRaw

func (c *ThumbnailClient) GenerateAsRaw(sourcePath string, output string, option ThumbnailOption) (io.ReadCloser, error)

func (*ThumbnailClient) Resize

func (c *ThumbnailClient) Resize(sourcePath string, option ThumbnailOption) ([]byte, error)

func (*ThumbnailClient) ResizeWithByte

func (c *ThumbnailClient) ResizeWithByte(ctx context.Context, input io.ReadCloser, option ThumbnailOption) (io.ReadCloser, error)

type ThumbnailOption

type ThumbnailOption struct {
	MaxWidth  int    `hsource:"query" hname:"maxWidth"`
	MaxHeight int    `hsource:"query" hname:"maxHeight"`
	Mode      string `hsource:"query" hname:"mode"`
}

func (*ThumbnailOption) GetSize

func (o *ThumbnailOption) GetSize(imageWidth, imageHeight int) (thumbnailWidth int, thumbnailHeight int)

type ThumbnailProcess

type ThumbnailProcess interface {
	Resize(ctx context.Context, input io.ReadCloser, option ThumbnailOption) (io.ReadCloser, error)
}

type ThumbnailServiceConfig

type ThumbnailServiceConfig struct {
	Enable     bool
	ServiceUrl string
}

type ThumbnailServicePlugin

type ThumbnailServicePlugin struct {
	Client *ThumbnailClient

	Logger *youlog.Scope
	Prefix string
	// contains filtered or unexported fields
}

func (*ThumbnailServicePlugin) OnInit

func (*ThumbnailServicePlugin) Resize

func (*ThumbnailServicePlugin) SetConfig

func (p *ThumbnailServicePlugin) SetConfig(config *ThumbnailServiceConfig)

type VipsThumbnailEngine

type VipsThumbnailEngine struct {
	Target string
}

func NewVipsThumbnailEngine

func NewVipsThumbnailEngine(target string) *VipsThumbnailEngine

func (*VipsThumbnailEngine) Resize

Jump to

Keyboard shortcuts

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