diff --git a/services/thumbnails/README.md b/services/thumbnails/README.md index 2e38a46e4a0..345d67274ab 100644 --- a/services/thumbnails/README.md +++ b/services/thumbnails/README.md @@ -53,10 +53,10 @@ Returned: 15x10 Image generation can be configured by defining different processors, following processors are available: -* resize -* fit -* fill -* thumbnail +* resize +* fit +* fill +* thumbnail to apply one of those, a query parameter has to be added to the request, e.g. `?processor=fit` diff --git a/services/thumbnails/pkg/thumbnail/generator.go b/services/thumbnails/pkg/thumbnail/generator.go index 984087ff89b..e8d967c4eb9 100644 --- a/services/thumbnails/pkg/thumbnail/generator.go +++ b/services/thumbnails/pkg/thumbnail/generator.go @@ -18,7 +18,7 @@ type Generator interface { // SimpleGenerator is the default image generator and is used for all image types expect gif. type SimpleGenerator struct{} -// Generate creates the image version based on the processor. +// Generate generates a alternative image version. func (g SimpleGenerator) Generate(size image.Rectangle, img interface{}, processor Processor) (interface{}, error) { m, ok := img.(image.Image) if !ok { @@ -31,6 +31,7 @@ func (g SimpleGenerator) Generate(size image.Rectangle, img interface{}, process // GifGenerator is used to create a web friendly version of the provided gif image. type GifGenerator struct{} +// Generate generates a alternative gif version. func (g GifGenerator) Generate(size image.Rectangle, img interface{}, processor Processor) (interface{}, error) { // Code inspired by https://github.com/willnorris/gifresize/blob/db93a7e1dcb1c279f7eeb99cc6d90b9e2e23e871/gifresize.go diff --git a/services/thumbnails/pkg/thumbnail/processor.go b/services/thumbnails/pkg/thumbnail/processor.go index 5101518e10d..3782fac4fce 100644 --- a/services/thumbnails/pkg/thumbnail/processor.go +++ b/services/thumbnails/pkg/thumbnail/processor.go @@ -28,7 +28,7 @@ func (p DefinableProcessor) Process(img image.Image, width, height int, filter i } // ProcessorFor returns a matching Processor -func ProcessorFor(id, fileType string) (Processor, error) { +func ProcessorFor(id, fileType string) (DefinableProcessor, error) { switch strings.ToLower(id) { case "fit": return DefinableProcessor{Slug: strings.ToLower(id), Converter: imaging.Fit}, nil