filer: skip resizing image if width or height larger than original image

fix https://github.com/chrislusf/seaweedfs/issues/1239#issuecomment-602140779
This commit is contained in:
Chris Lu
2020-03-21 22:16:00 -07:00
parent 7c111f7b75
commit 6ff9e2835e
3 changed files with 56 additions and 13 deletions

View File

@@ -6,10 +6,11 @@ import (
"image/gif"
"image/jpeg"
"image/png"
"io"
"github.com/disintegration/imaging"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/disintegration/imaging"
"io"
)
func Resized(ext string, read io.ReadSeeker, width, height int, mode string) (resized io.ReadSeeker, w int, h int) {
@@ -35,6 +36,7 @@ func Resized(ext string, read io.ReadSeeker, width, height int, mode string) (re
}
}
} else {
read.Seek(0, 0)
return read, bounds.Dx(), bounds.Dy()
}
var buf bytes.Buffer