SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
WebP resize support
Vitaly Baev7ab9160ee125
diff --git a/weed/images/preprocess.go b/weed/images/preprocess.goindex 0d6cb2d9e5..968cda44f0 100644--- a/weed/images/preprocess.go+++ b/weed/images/preprocess.go@@ -17,7 +17,7 @@ func MaybePreprocessImage(filename string, data []byte, width, height int) (resiext := filepath.Ext(filename)ext = strings.ToLower(ext)switch ext {- case ".png", ".gif":+ case ".png", ".gif", ".webp":return Resized(ext, data, width, height)case ".jpg", ".jpeg":data = FixJpgOrientation(data)diff --git a/weed/images/resizing.go b/weed/images/resizing.goindex 7e4a88c42f..e644570cbc 100644--- a/weed/images/resizing.go+++ b/weed/images/resizing.go@@ -6,6 +6,7 @@ import ("image/gif""image/jpeg""image/png"+ "github.com/chai2010/webp""github.com/chrislusf/seaweedfs/weed/glog""github.com/disintegration/imaging"@@ -37,6 +38,8 @@ func Resized(ext string, data []byte, width, height int) (resized []byte, w int,jpeg.Encode(&buf, dstImage, nil)case ".gif":gif.Encode(&buf, dstImage, nil)+ case ".webp":+ webp.Encode(&buf, dstImage, &webp.Options{Quality: 70})}return buf.Bytes(), dstImage.Bounds().Dx(), dstImage.Bounds().Dy()} else {diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.goindex 2e33b415c1..3d15d790e1 100644--- a/weed/server/volume_server_handlers_read.go+++ b/weed/server/volume_server_handlers_read.go@@ -136,7 +136,7 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)}}}- if ext == ".png" || ext == ".jpg" || ext == ".gif" {+ if ext == ".png" || ext == ".jpg" || ext == ".gif"|| ext == ".webp" {width, height := 0, 0if r.FormValue("width") != "" {width, _ = strconv.Atoi(r.FormValue("width"))