From a53203c62bfa168d4d2e274f6a744dba35b87a50 Mon Sep 17 00:00:00 2001 From: withchao <993506633@qq.com> Date: Mon, 15 Jul 2024 11:15:19 +0800 Subject: [PATCH] fix: s3 interface --- s3/cos/cos.go | 4 ---- s3/minio/minio.go | 15 --------------- s3/oss/oss.go | 4 ---- s3/s3.go | 2 -- 4 files changed, 25 deletions(-) diff --git a/s3/cos/cos.go b/s3/cos/cos.go index e0512026..3c34a92b 100644 --- a/s3/cos/cos.go +++ b/s3/cos/cos.go @@ -401,7 +401,3 @@ func sha1val(msg string) string { sha1Hash.Write([]byte(msg)) return hex.EncodeToString(sha1Hash.Sum(nil)) } - -func (m *Cos) GetImageThumbnailKey(ctx context.Context, name string) (string, error) { - panic("implement me.") -} diff --git a/s3/minio/minio.go b/s3/minio/minio.go index 4b21b0ec..55b26b6e 100644 --- a/s3/minio/minio.go +++ b/s3/minio/minio.go @@ -22,7 +22,6 @@ import ( "net/http" "net/url" "path" - "path/filepath" "reflect" "strconv" "strings" @@ -498,17 +497,3 @@ 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 -} diff --git a/s3/oss/oss.go b/s3/oss/oss.go index 9fb6837f..c2e82b2e 100644 --- a/s3/oss/oss.go +++ b/s3/oss/oss.go @@ -383,7 +383,3 @@ func (o *OSS) FormData(ctx context.Context, name string, size int64, contentType } return fd, nil } - -func (m *OSS) GetImageThumbnailKey(ctx context.Context, name string) (string, error) { - panic("implement me.") -} diff --git a/s3/s3.go b/s3/s3.go index 2d7a185b..d3dd90ae 100644 --- a/s3/s3.go +++ b/s3/s3.go @@ -163,6 +163,4 @@ type Interface interface { AccessURL(ctx context.Context, name string, expire time.Duration, opt *AccessURLOption) (string, error) FormData(ctx context.Context, name string, size int64, contentType string, duration time.Duration) (*FormData, error) - - GetImageThumbnailKey(ctx context.Context, name string) (string, error) }