Documentation ¶
Index ¶
- func GenerateThumbnail(ctx context.Context, src types.Path, config types.ThumbnailSize, ...) (busy bool, errorReturn error)
- func GenerateThumbnails(ctx context.Context, src types.Path, configs []config.ThumbnailSize, ...) (busy bool, errorReturn error)
- func GetThumbnailPath(src types.Path, config types.ThumbnailSize) types.Path
- func SelectThumbnail(desired types.ThumbnailSize, thumbnails []*types.ThumbnailMetadata, ...) (*types.ThumbnailMetadata, *types.ThumbnailSize)
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 ¶
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.