thumbnailer

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateThumbnail

func GenerateThumbnail(
	ctx context.Context,
	src types.Path,
	config types.ThumbnailSize,
	mediaMetadata *types.MediaMetadata,
	activeThumbnailGeneration *types.ActiveThumbnailGeneration,
	maxThumbnailGenerators int,
	db storage.Database,
	logger *log.Entry,
) (busy bool, errorReturn error)

GenerateThumbnail generates the configured thumbnail size for the source file

func GenerateThumbnails

func GenerateThumbnails(
	ctx context.Context,
	src types.Path,
	configs []config.ThumbnailSize,
	mediaMetadata *types.MediaMetadata,
	activeThumbnailGeneration *types.ActiveThumbnailGeneration,
	maxThumbnailGenerators int,
	db storage.Database,
	logger *log.Entry,
) (busy bool, errorReturn error)

GenerateThumbnails generates the configured thumbnail sizes for the source file

func GetThumbnailPath

func GetThumbnailPath(src types.Path, config types.ThumbnailSize) types.Path

GetThumbnailPath returns the path to a thumbnail given the absolute src path and thumbnail size configuration

func SelectThumbnail

func SelectThumbnail(desired types.ThumbnailSize, thumbnails []*types.ThumbnailMetadata, thumbnailSizes []config.ThumbnailSize) (*types.ThumbnailMetadata, *types.ThumbnailSize)

SelectThumbnail compares the (potentially) available thumbnails with the desired thumbnail and returns the best match The algorithm is very similar to what was implemented in Synapse In order of priority unless absolute, the following metrics are compared; the image is: * the same size or larger than requested * if a cropped image is desired, has an aspect ratio close to requested * has a size close to requested * if a cropped image is desired, prefer the same method, if scaled is desired, absolutely require scaled * has a small file size If a pre-generated thumbnail size is the best match, but it has not been generated yet, the caller can use the returned size to generate it. Returns nil if no thumbnail matches the criteria

Types

This section is empty.

Jump to

Keyboard shortcuts

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