summaryrefslogtreecommitdiff
path: root/internal
diff options
from:
to:
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/converter/processor_interface.go (renamed from internal/processor/processor_interface.go)4
-rw-r--r--internal/converter/webp.go (renamed from internal/processor/webp.go)16
2 files changed, 10 insertions, 10 deletions
diff --git a/internal/processor/processor_interface.go b/internal/converter/processor_interface.go
index 7cf20f2..88b5ac3 100644
--- a/internal/processor/processor_interface.go
+++ b/internal/converter/processor_interface.go
@@ -1,8 +1,8 @@
-package processor
+package converter
import "io"
-type Processor interface {
+type Converter interface {
DeductOutputPath(inputPath string) string
Process(ext string, reader io.ReadCloser, writer io.WriteCloser) error
}
diff --git a/internal/processor/webp.go b/internal/converter/webp.go
index 86ff567..b7f1216 100644
--- a/internal/processor/webp.go
+++ b/internal/converter/webp.go
@@ -1,4 +1,4 @@
-package processor
+package converter
import (
"fmt"
@@ -16,24 +16,24 @@ import (
"github.com/kolesa-team/go-webp/webp"
)
-var _ Processor = (*WebpProcessor)(nil)
+var _ Converter = (*WebpConverter)(nil)
-type WebpProcessor struct {
+type WebpConverter struct {
maxWidth int
maxHeight int
quality int
}
-func NewWebpProcessor(cfg *config.ProcessorConfig) (*WebpProcessor, error) {
+func NewWebpConverter(cfg *config.ConverterConfig) (*WebpConverter, error) {
if cfg.Type != "webp" {
- return nil, fmt.Errorf("invalid storage type for WebpProcessor")
+ return nil, fmt.Errorf("invalid storage type for WebpConverter")
}
webpCfg := cfg.Config.(*config.WebpConfig)
- return &WebpProcessor{webpCfg.Size.MaxWidth, webpCfg.Size.MaxHeight, webpCfg.Quality}, nil
+ return &WebpConverter{webpCfg.Size.MaxWidth, webpCfg.Size.MaxHeight, webpCfg.Quality}, nil
}
-func (p *WebpProcessor) DeductOutputPath(inputPath string) string {
+func (p *WebpConverter) DeductOutputPath(inputPath string) string {
pathParts := strings.Split(inputPath, ".")
if len(pathParts) < 2 {
return inputPath + ".webp"
@@ -42,7 +42,7 @@ func (p *WebpProcessor) DeductOutputPath(inputPath string) string {
return strings.Join(pathParts, ".")
}
-func (p *WebpProcessor) Process(contentType string, reader io.ReadCloser, writer io.WriteCloser) error {
+func (p *WebpConverter) Process(contentType string, reader io.ReadCloser, writer io.WriteCloser) error {
var src image.Image
var err error