Skip to content

Commit

Permalink
fix: s3 interface
Browse files Browse the repository at this point in the history
  • Loading branch information
withchao committed Jul 15, 2024
1 parent 3c838fc commit efde3f3
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions s3/minio/minio.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"net/http"
"net/url"
"path"
"path/filepath"
"reflect"
"strconv"
"strings"
Expand Down Expand Up @@ -497,3 +498,17 @@ func (m *Minio) FormData(ctx context.Context, name string, size int64, contentTy
SuccessCodes: []int{successCode},
}, nil
}

func (m *Minio) GetImageThumbnailKey(ctx context.Context, name string) (string, error) {
info, img, err := m.getObjectImageInfo(ctx, name)
if err != nil {
return "", errs.Wrap(err)
}
if !info.IsImg {
return "", errs.New("object not image").Wrap()
}
thumbnailWidth, thumbnailHeight := getThumbnailSize(img)

cacheKey := filepath.Join(imageThumbnailPath, info.Etag, fmt.Sprintf("image_w%d_h%d.%s", thumbnailWidth, thumbnailHeight, info.Format))
return cacheKey, nil
}

0 comments on commit efde3f3

Please sign in to comment.