aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislusf <chris.lu@gmail.com>2015-04-10 07:58:14 -0700
committerchrislusf <chris.lu@gmail.com>2015-04-10 07:58:14 -0700
commitce676ee100c3013d67396edbed893a57273afe6d (patch)
tree447f07ed340d6d03af21af969235609746e217bc
parent71e9b302d458de555a5c7cf8945d378d5b1c6b66 (diff)
parentfcfa4d4ca92fedfa7dc25d8d7c85ca3b250e0c72 (diff)
downloadseaweedfs-ce676ee100c3013d67396edbed893a57273afe6d.tar.xz
seaweedfs-ce676ee100c3013d67396edbed893a57273afe6d.zip
Merge pull request #114 from yanyiwu/master
log image Decode error for some kind of pictures
-rw-r--r--go/images/resizing.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/go/images/resizing.go b/go/images/resizing.go
index e9de5f7d7..7187a1089 100644
--- a/go/images/resizing.go
+++ b/go/images/resizing.go
@@ -7,6 +7,7 @@ import (
"image/jpeg"
"image/png"
+ "github.com/chrislusf/weed-fs/go/glog"
"github.com/disintegration/imaging"
)
@@ -14,7 +15,8 @@ func Resized(ext string, data []byte, width, height int) (resized []byte, w int,
if width == 0 && height == 0 {
return data, 0, 0
}
- if srcImage, _, err := image.Decode(bytes.NewReader(data)); err == nil {
+ srcImage, _, err := image.Decode(bytes.NewReader(data))
+ if err == nil {
bounds := srcImage.Bounds()
var dstImage *image.NRGBA
if bounds.Dx() > width && width != 0 || bounds.Dy() > height && height != 0 {
@@ -37,6 +39,8 @@ func Resized(ext string, data []byte, width, height int) (resized []byte, w int,
gif.Encode(&buf, dstImage, nil)
}
return buf.Bytes(), dstImage.Bounds().Dx(), dstImage.Bounds().Dy()
+ } else {
+ glog.Error(err)
}
return data, 0, 0
}