aboutsummaryrefslogtreecommitdiff
path: root/weed/images
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-03-21 22:16:00 -0700
committerChris Lu <chris.lu@gmail.com>2020-03-21 22:16:00 -0700
commit6ff9e2835e822d7f005ea9fd02966ff069d9efc1 (patch)
treec0a6c174f923f2dd0ac4c320d60315368c10dd9a /weed/images
parent7c111f7b75ba2b0a95766897503997d65d05b42c (diff)
downloadseaweedfs-6ff9e2835e822d7f005ea9fd02966ff069d9efc1.tar.xz
seaweedfs-6ff9e2835e822d7f005ea9fd02966ff069d9efc1.zip
filer: skip resizing image if width or height larger than original image
fix https://github.com/chrislusf/seaweedfs/issues/1239#issuecomment-602140779
Diffstat (limited to 'weed/images')
-rw-r--r--weed/images/resizing.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/images/resizing.go b/weed/images/resizing.go
index ff0eff5e1..b048daa1c 100644
--- a/weed/images/resizing.go
+++ b/weed/images/resizing.go
@@ -6,10 +6,11 @@ import (
"image/gif"
"image/jpeg"
"image/png"
+ "io"
- "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/disintegration/imaging"
- "io"
+
+ "github.com/chrislusf/seaweedfs/weed/glog"
)
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