fix: adapt to new function signatures
To allow to bump to latest kovidgoyal/imaging release
This commit is contained in:
committed by
Ralf Haferkamp
parent
85361fca67
commit
3badc66d4a
@@ -10,20 +10,20 @@ import (
|
||||
// Processor processes the thumbnail by applying different transformations to it.
|
||||
type Processor interface {
|
||||
ID() string
|
||||
Process(img image.Image, width, height int, filter imaging.ResampleFilter) *image.NRGBA
|
||||
Process(img image.Image, width, height int, filter imaging.ResampleFilter) image.Image
|
||||
}
|
||||
|
||||
// DefinableProcessor is the simplest processor, it holds a replaceable image converter function.
|
||||
type DefinableProcessor struct {
|
||||
Slug string
|
||||
Converter func(img image.Image, width, height int, filter imaging.ResampleFilter) *image.NRGBA
|
||||
Converter func(img image.Image, width, height int, filter imaging.ResampleFilter) image.Image
|
||||
}
|
||||
|
||||
// ID returns the processor identification.
|
||||
func (p DefinableProcessor) ID() string { return p.Slug }
|
||||
|
||||
// Process transforms the given image.
|
||||
func (p DefinableProcessor) Process(img image.Image, width, height int, filter imaging.ResampleFilter) *image.NRGBA {
|
||||
func (p DefinableProcessor) Process(img image.Image, width, height int, filter imaging.ResampleFilter) image.Image {
|
||||
return p.Converter(img, width, height, filter)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func ProcessorFor(id, fileType string) (DefinableProcessor, error) {
|
||||
case "resize":
|
||||
return DefinableProcessor{Slug: strings.ToLower(id), Converter: imaging.Resize}, nil
|
||||
case "fill":
|
||||
return DefinableProcessor{Slug: strings.ToLower(id), Converter: func(img image.Image, width, height int, filter imaging.ResampleFilter) *image.NRGBA {
|
||||
return DefinableProcessor{Slug: strings.ToLower(id), Converter: func(img image.Image, width, height int, filter imaging.ResampleFilter) image.Image {
|
||||
return imaging.Fill(img, width, height, imaging.Center, filter)
|
||||
}}, nil
|
||||
case "thumbnail":
|
||||
|
||||
Reference in New Issue
Block a user