blob: c35db08317aa64187477379011e995a79b5bd668 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package thumbnail
import (
"context"
"github.com/RanXom/galleryd/internal/gallery"
)
// Generator creates thumbnails for gallery photos
type Generator struct {
cacheDir string
}
func New(cacheDir string) *Generator {
return &Generator{
cacheDir: cacheDir,
}
}
// Generate creates (or retrieves) a thumbnail
func (g *Generator) Generate(
ctx context.Context,
photo gallery.Photo,
) (Thumbnail, error) {
return Thumbnail{
Path: g.cachePath(photo),
}, nil
}
|