thumbnail

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateThumbnail

func GenerateThumbnail(imagePath string, maxSize int) (string, error)

GenerateWithoutCache creates a thumbnail without caching (for temporary files)

Types

type Generator

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

Generator handles thumbnail generation and caching

func NewGenerator

func NewGenerator(cache *duplicate.SQLiteCache) *Generator

NewGenerator creates a new thumbnail generator

func (*Generator) Generate

func (g *Generator) Generate(ctx context.Context, imagePath string, maxSize int) (*Result, error)

Generate creates or retrieves a thumbnail for the given image path

func (*Generator) GetCachedThumbnail added in v0.9.0

func (g *Generator) GetCachedThumbnail(ctx context.Context, key string) (*duplicate.Thumbnail, error)

GetCachedThumbnail retrieves a thumbnail from cache by key

func (*Generator) SaveThumbnail added in v0.9.0

func (g *Generator) SaveThumbnail(thumb *duplicate.Thumbnail) error

SaveThumbnail saves a thumbnail to cache

type ImageInfo

type ImageInfo struct {
	Width    int
	Height   int
	FileSize int64
	MD5Hash  string
}

ImageInfo contains information about an image

type Result

type Result struct {
	ThumbnailData string // base64 encoded
	Info          ImageInfo
}

Result contains the thumbnail and image info

Jump to

Keyboard shortcuts

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