aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2014-05-07 12:52:42 -0700
committerChris Lu <chris.lu@gmail.com>2014-05-07 12:52:42 -0700
commit1c30a780a71b6bd037aeef8ee8456c8a1ae71f96 (patch)
tree1a9dfb97085eee829b9a5d6bd0b973b0e34da945
parent729716ab7a19dc774c9acce84eed491711f3da4d (diff)
downloadseaweedfs-1c30a780a71b6bd037aeef8ee8456c8a1ae71f96.tar.xz
seaweedfs-1c30a780a71b6bd037aeef8ee8456c8a1ae71f96.zip
fix image serving performance problem introduced in last release.
-rw-r--r--go/weed/weed_server/volume_server_handlers.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/go/weed/weed_server/volume_server_handlers.go b/go/weed/weed_server/volume_server_handlers.go
index 3c94a75f1..76b760d46 100644
--- a/go/weed/weed_server/volume_server_handlers.go
+++ b/go/weed/weed_server/volume_server_handlers.go
@@ -125,15 +125,15 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request,
}
}
if ext == ".png" || ext == ".jpg" || ext == ".gif" {
- if srcImage, _, err := image.Decode(bytes.NewReader(n.Data)); err == nil {
- width, height := 0, 0
- if r.FormValue("width") != "" {
- width, _ = strconv.Atoi(r.FormValue("width"))
- }
- if r.FormValue("height") != "" {
- height, _ = strconv.Atoi(r.FormValue("height"))
- }
- if width != 0 || height != 0 {
+ width, height := 0, 0
+ if r.FormValue("width") != "" {
+ width, _ = strconv.Atoi(r.FormValue("width"))
+ }
+ if r.FormValue("height") != "" {
+ height, _ = strconv.Atoi(r.FormValue("height"))
+ }
+ if width != 0 || height != 0 {
+ if srcImage, _, err := image.Decode(bytes.NewReader(n.Data)); err == nil {
bounds := srcImage.Bounds()
var dstImage *image.NRGBA
if width == height && bounds.Dx() != bounds.Dy() {