feat(thumb): use libvips to generate thumb

This commit is contained in:
Aaron Liu
2023-04-07 19:30:10 +08:00
parent bde4459519
commit b55344459d
5 changed files with 88 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package thumb
import (
"context"
"fmt"
"image"
"image/gif"
@@ -156,7 +157,7 @@ func (image *Thumb) CreateAvatar(uid uint) error {
type Builtin struct{}
func (b Builtin) Generate(file io.Reader, name string, options map[string]string) (string, error) {
func (b Builtin) Generate(ctx context.Context, file io.Reader, name string, options map[string]string) (string, error) {
img, err := NewThumbFromFile(file, name)
if err != nil {
return "", err