revert webp support due to "go test"

related to https://github.com/chai2010/webp/issues/9
This commit is contained in:
Chris Lu 2017-05-28 10:25:40 -07:00
parent 48919009fc
commit 83efe1547d
3 changed files with 2 additions and 5 deletions

View file

@ -17,7 +17,7 @@ func MaybePreprocessImage(filename string, data []byte, width, height int) (resi
ext := filepath.Ext(filename) ext := filepath.Ext(filename)
ext = strings.ToLower(ext) ext = strings.ToLower(ext)
switch ext { switch ext {
case ".png", ".gif", ".webp": case ".png", ".gif":
return Resized(ext, data, width, height, "") return Resized(ext, data, width, height, "")
case ".jpg", ".jpeg": case ".jpg", ".jpeg":
data = FixJpgOrientation(data) data = FixJpgOrientation(data)

View file

@ -6,7 +6,6 @@ import (
"image/gif" "image/gif"
"image/jpeg" "image/jpeg"
"image/png" "image/png"
"github.com/chai2010/webp"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/disintegration/imaging" "github.com/disintegration/imaging"
@ -45,8 +44,6 @@ func Resized(ext string, data []byte, width, height int, mode string) (resized [
jpeg.Encode(&buf, dstImage, nil) jpeg.Encode(&buf, dstImage, nil)
case ".gif": case ".gif":
gif.Encode(&buf, dstImage, nil) gif.Encode(&buf, dstImage, nil)
case ".webp":
webp.Encode(&buf, dstImage, &webp.Options{Quality: 70})
} }
return buf.Bytes(), dstImage.Bounds().Dx(), dstImage.Bounds().Dy() return buf.Bytes(), dstImage.Bounds().Dx(), dstImage.Bounds().Dy()
} else { } else {

View file

@ -136,7 +136,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
} }
} }
} }
if ext == ".png" || ext == ".jpg" || ext == ".gif"|| ext == ".webp" { if ext == ".png" || ext == ".jpg" || ext == ".gif" {
width, height := 0, 0 width, height := 0, 0
if r.FormValue("width") != "" { if r.FormValue("width") != "" {
width, _ = strconv.Atoi(r.FormValue("width")) width, _ = strconv.Atoi(r.FormValue("width"))