summaryrefslogtreecommitdiffstats
path: root/internal/media
diff options
context:
space:
mode:
Diffstat (limited to 'internal/media')
-rw-r--r--internal/media/process.go7
1 files changed, 2 insertions, 5 deletions
diff --git a/internal/media/process.go b/internal/media/process.go
index bb3ac89..ac94155 100644
--- a/internal/media/process.go
+++ b/internal/media/process.go
@@ -11,10 +11,6 @@ import (
//
// width <= 0 means no resize. format must be "webp" or "jpeg".
func ConvertAndResize(src string, width int, format string) ([]byte, error) {
- if format != "webp" && format != "jpeg" {
- return nil, fmt.Errorf("unsupported format %q: must be webp or jpeg", format)
- }
-
img, err := vips.NewImageFromFile(src)
if err != nil {
return nil, fmt.Errorf("load image %s: %w", src, err)
@@ -41,6 +37,7 @@ func ConvertAndResize(src string, width int, format string) ([]byte, error) {
return nil, fmt.Errorf("export jpeg: %w", err)
}
return buf, nil
+ default:
+ return nil, fmt.Errorf("unsupported format %q: must be webp or jpeg", format)
}
- return nil, fmt.Errorf("unsupported format %q", format)
}