Skip to content

Commit

Permalink
Allow WebP as source
Browse files Browse the repository at this point in the history
  • Loading branch information
n0vad3v committed Dec 1, 2023
1 parent d173c8c commit f075dfa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

This is a Server based on Golang, which allows you to serve WebP images on the fly.

Currently supported image format: JPEG, PNG, BMP, GIF, SVG, HEIC, NEF
Currently supported image format: JPEG, PNG, BMP, GIF, SVG, HEIC, NEF, WEBP

> e.g When you visit `https://your.website/pics/tsuki.jpg`,it will serve as `image/webp`/`image/avif` format without changing the URL.
>
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func NewWebPConfig() *WebpConfig {
Port: "3333",
ImgPath: "./pics",
Quality: 80,
AllowedTypes: []string{"jpg", "png", "jpeg", "bmp", "svg", "nef", "heic"},
AllowedTypes: []string{"jpg", "png", "jpeg", "bmp", "svg", "nef", "heic", "webp"},
ImageMap: map[string]string{},
ExhaustPath: "./exhaust",
EnableAVIF: false,
Expand Down
2 changes: 2 additions & 0 deletions encoder/encoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ var (
boolFalse vips.BoolParameter
intMinusOne vips.IntParameter
// Source image encoder ignore list for WebP and AVIF
// We shouldn't convert Unknown and AVIF to WebP
webpIgnore = []vips.ImageType{vips.ImageTypeUnknown, vips.ImageTypeAVIF}
// We shouldn't convert Unknown,AVIF and GIF to AVIF
avifIgnore = append(webpIgnore, vips.ImageTypeGIF)
)

Expand Down

0 comments on commit f075dfa

Please sign in to comment.