Documentation ¶
Index ¶
- Variables
- func RegisterGenerator(generator Generator)
- func Resize(newWidth, newHeight uint, img image.Image) image.Image
- func TestGenerator(ctx context.Context, name, executable string) (string, error)
- func Thumbnail(maxWidth, maxHeight uint, img image.Image) image.Image
- type Builtin
- type FfmpegGenerator
- type Generator
- type GeneratorList
- func (p GeneratorList) EnableFlag() string
- func (p GeneratorList) Generate(ctx context.Context, file io.Reader, src, name string, ...) (*Result, error)
- func (g GeneratorList) Len() int
- func (g GeneratorList) Less(i, j int) bool
- func (p GeneratorList) Priority() int
- func (g GeneratorList) Swap(i, j int)
- type GeneratorType
- type LibreOfficeGenerator
- type Result
- type Thumb
- type VipsGenerator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Generators = GeneratorList{} ErrPassThrough = errors.New("pass through") ErrNotAvailable = fmt.Errorf("thumbnail not available: %w", ErrPassThrough) )
View Source
var ( ErrUnknownGenerator = errors.New("unknown generator type") ErrUnknownOutput = errors.New("unknown output from generator") )
Functions ¶
func RegisterGenerator ¶
func RegisterGenerator(generator Generator)
RegisterGenerator registers a thumbnail generator.
func TestGenerator ¶
TestGenerator tests thumb generator by getting lib version
Types ¶
type FfmpegGenerator ¶
type FfmpegGenerator struct {
// contains filtered or unexported fields
}
func (*FfmpegGenerator) EnableFlag ¶
func (f *FfmpegGenerator) EnableFlag() string
func (*FfmpegGenerator) Priority ¶
func (f *FfmpegGenerator) Priority() int
type Generator ¶
type Generator interface { // Generate generates a thumbnail for a given reader. Src is the original file path, only provided // for local policy files. Generate(ctx context.Context, file io.Reader, src string, name string, options map[string]string) (*Result, error) // Priority of execution order, smaller value means higher priority. Priority() int // EnableFlag returns the setting name to enable this generator. EnableFlag() string }
Generator generates a thumbnail for a given reader.
type GeneratorList ¶
type GeneratorList []Generator
func (GeneratorList) EnableFlag ¶
func (p GeneratorList) EnableFlag() string
func (GeneratorList) Len ¶
func (g GeneratorList) Len() int
func (GeneratorList) Less ¶
func (g GeneratorList) Less(i, j int) bool
func (GeneratorList) Priority ¶
func (p GeneratorList) Priority() int
func (GeneratorList) Swap ¶
func (g GeneratorList) Swap(i, j int)
type GeneratorType ¶
type GeneratorType string
type LibreOfficeGenerator ¶
type LibreOfficeGenerator struct {
// contains filtered or unexported fields
}
func (*LibreOfficeGenerator) EnableFlag ¶
func (l *LibreOfficeGenerator) EnableFlag() string
func (*LibreOfficeGenerator) Priority ¶
func (l *LibreOfficeGenerator) Priority() int
type Thumb ¶
type Thumb struct {
// contains filtered or unexported fields
}
Thumb 缩略图
func NewThumbFromFile ¶
NewThumbFromFile 从文件数据获取新的Thumb对象, 尝试通过文件名name解码图像
type VipsGenerator ¶
type VipsGenerator struct {
// contains filtered or unexported fields
}
func (*VipsGenerator) EnableFlag ¶
func (v *VipsGenerator) EnableFlag() string
func (*VipsGenerator) Priority ¶
func (v *VipsGenerator) Priority() int
Click to show internal directories.
Click to hide internal directories.