mirror of
https://github.com/photoprism/photoprism.git
synced 2025-09-26 21:01:58 +08:00
32 lines
805 B
Go
32 lines
805 B
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
"github.com/photoprism/photoprism/internal/thumb"
|
|
"github.com/photoprism/photoprism/pkg/txt/report"
|
|
)
|
|
|
|
// ShowThumbSizesCommand configures the command name, flags, and action.
|
|
var ShowThumbSizesCommand = &cli.Command{
|
|
Name: "thumb-sizes",
|
|
Aliases: []string{"thumbs"},
|
|
Usage: "Displays supported thumbnail types and sizes",
|
|
Flags: report.CliFlags,
|
|
Action: showThumbSizesAction,
|
|
}
|
|
|
|
// showThumbSizesAction displays supported standard thumbnail sizes.
|
|
func showThumbSizesAction(ctx *cli.Context) error {
|
|
rows, cols := thumb.Report(thumb.Sizes.All(), false)
|
|
format, ferr := report.CliFormatStrict(ctx)
|
|
if ferr != nil {
|
|
return ferr
|
|
}
|
|
result, err := report.RenderFormat(rows, cols, format)
|
|
fmt.Println(result)
|
|
return err
|
|
}
|