Skip to content

Commit

Permalink
fix: codacy and code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
fschade committed Oct 15, 2023
1 parent d491d3c commit a514837
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions services/thumbnails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
3 changes: 2 additions & 1 deletion services/thumbnails/pkg/thumbnail/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion services/thumbnails/pkg/thumbnail/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a514837

Please sign in to comment.