mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 13:42:02 +08:00
Now we support animated GIF images (#232)
* Now we support animated GIF images * Fix CI * Update runtime image
This commit is contained in:
parent
90680bef6c
commit
2c0dd15222
@ -1,4 +1,4 @@
|
||||
FROM golang:1.20 as builder
|
||||
FROM golang:1.20-bookworm as builder
|
||||
|
||||
ARG IMG_PATH=/opt/pics
|
||||
ARG EXHAUST_PATH=/opt/exhaust
|
||||
@ -12,7 +12,7 @@ RUN cd /build && sed -i "s|.\/pics|${IMG_PATH}|g" config.json \
|
||||
&& sed -i 's/127.0.0.1/0.0.0.0/g' config.json \
|
||||
&& go build -ldflags="-s -w" -o webp-server .
|
||||
|
||||
FROM debian:bullseye-slim
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
RUN apt update && apt install --no-install-recommends libvips ca-certificates libjemalloc2 libtcmalloc-minimal4 -y && rm -rf /var/lib/apt/lists/* && rm -rf /var/cache/apt/archives/*
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
This is a Server based on Golang, which allows you to serve WebP images on the fly.
|
||||
It will convert `jpg,jpeg,png` files by default, this can be customized by editing the `config.json`..
|
||||
* currently supported image format: JPEG, PNG, BMP, GIF(static image for now)
|
||||
* currently supported image format: JPEG, PNG, BMP, GIF
|
||||
|
||||
> e.g When you visit `https://your.website/pics/tsuki.jpg`,it will serve as `image/webp` format without changing the URL.
|
||||
>
|
||||
@ -65,7 +65,7 @@ The default `config.json` may look like this.
|
||||
"QUALITY": "80",
|
||||
"IMG_PATH": "/path/to/pics",
|
||||
"EXHAUST_PATH": "/path/to/exhaust",
|
||||
"ALLOWED_TYPES": ["jpg","png","jpeg","bmp"],
|
||||
"ALLOWED_TYPES": ["jpg","png","jpeg","bmp","gif"],
|
||||
"ENABLE_AVIF": false,
|
||||
"ENABLE_EXTRA_PARAMS": false
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ var (
|
||||
prefetch, proxyMode bool
|
||||
remoteRaw = "remote-raw"
|
||||
config Config
|
||||
version = "0.8.4"
|
||||
version = "0.9.0"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -42,7 +42,7 @@ const (
|
||||
"QUALITY": "80",
|
||||
"IMG_PATH": "./pics",
|
||||
"EXHAUST_PATH": "./exhaust",
|
||||
"ALLOWED_TYPES": ["jpg","png","jpeg","bmp"],
|
||||
"ALLOWED_TYPES": ["jpg","png","jpeg","bmp","gif"],
|
||||
"ENABLE_AVIF": false,
|
||||
"ENABLE_EXTRA_PARAMS": false
|
||||
}`
|
||||
|
@ -4,7 +4,7 @@
|
||||
"QUALITY": "80",
|
||||
"IMG_PATH": "./pics",
|
||||
"EXHAUST_PATH": "./exhaust",
|
||||
"ALLOWED_TYPES": ["jpg","png","jpeg","bmp"],
|
||||
"ALLOWED_TYPES": ["jpg","png","jpeg","bmp","gif"],
|
||||
"ENABLE_AVIF": false,
|
||||
"ENABLE_EXTRA_PARAMS": false
|
||||
}
|
@ -99,6 +99,8 @@ func TestWebPEncoder(t *testing.T) {
|
||||
func TestAnimatedGIFWithWebPEncoder(t *testing.T) {
|
||||
runEncoder(t, "./pics/gif-animated.gif", dest)
|
||||
_ = os.Remove(dest)
|
||||
runEncoder(t, "./pics/no.gif", dest)
|
||||
_ = os.Remove(dest)
|
||||
}
|
||||
|
||||
func TestAvifEncoder(t *testing.T) {
|
||||
|
@ -20,7 +20,7 @@ func TestLoadConfig(t *testing.T) {
|
||||
assert.Equal(t, "3333", c.Port)
|
||||
assert.Equal(t, 80, c.Quality)
|
||||
assert.Equal(t, "./pics", c.ImgPath)
|
||||
assert.Equal(t, []string{"jpg", "png", "jpeg", "bmp"}, c.AllowedTypes)
|
||||
assert.Equal(t, []string{"jpg", "png", "jpeg", "bmp", "gif"}, c.AllowedTypes)
|
||||
}
|
||||
|
||||
func TestDeferInit(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user