mirror of
https://github.com/woodchen-ink/webp_server_go.git
synced 2025-07-18 05:32:02 +08:00
Update README (#195)
This commit is contained in:
parent
bcb3f1452b
commit
96802dc3bc
@ -66,10 +66,15 @@ The default `config.json` may look like this.
|
||||
"IMG_PATH": "/path/to/pics",
|
||||
"EXHAUST_PATH": "/path/to/exhaust",
|
||||
"ALLOWED_TYPES": ["jpg","png","jpeg","bmp"],
|
||||
"ENABLE_AVIF": false
|
||||
"ENABLE_AVIF": false,
|
||||
"ENABLE_EXTRA_PARAMS": false
|
||||
}
|
||||
```
|
||||
> AVIF support is disabled by default as converting images to AVIF is CPU consuming.
|
||||
|
||||
> `ENABLE_AVIF` means AVIF support, it's disabled by default as converting images to AVIF is CPU consuming.
|
||||
>
|
||||
> `ENABLE_EXTRA_PARAMS` means whether to enable Extra Parameters, basically it allows you to do some transform on images like `https://img.webp.sh/path/tsuki.jpg?width=20`, you can find more info on [Extra Parameters](https://docs.webp.sh/usage/extra-params/) page.
|
||||
|
||||
|
||||
#### Config Example
|
||||
|
||||
|
@ -73,7 +73,7 @@ func convertImage(raw, optimized, itype string, extraParams ExtraParams) error {
|
||||
// delete the old converted pic and convert a new one.
|
||||
// optimized: /home/webp_server/exhaust/path/to/tsuki.jpg.1582558990.webp
|
||||
// we'll delete file starts with /home/webp_server/exhaust/path/to/tsuki.jpg.ts.itype
|
||||
// If contain extraParams like tsuki.jpg?width=200, exhaust path will be /home/webp_server/exhaust/path/to/tsuki.jpg.1582558990.webp?width=200
|
||||
// If contain extraParams like tsuki.jpg?width=200, exhaust path will be /home/webp_server/exhaust/path/to/tsuki.jpg.1582558990.webp_width=200
|
||||
|
||||
s := strings.Split(path.Base(optimized), ".")
|
||||
pattern := path.Join(path.Dir(optimized), s[0]+"."+s[1]+".*."+s[len(s)-1])
|
||||
|
Loading…
x
Reference in New Issue
Block a user