thumbnail

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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) GetPluginConfig

func (p *ThumbnailServicePlugin) GetPluginConfig() map[string]interface{}

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