Based on docker
with golang
that convert images to webp
There are two ways to construct it, either way.
docker pull yhan219/webp-convert-service
docker build -t yhan219/webp-convert-service:1.0 .
docker run -d --name webp-service -p 80:80 yhan219/webp-convert-service:1.0
The service listens on port 80 for GET requests on the root path (/). Any other path returns a 404 not found status.
- url: The URL of the image to convert.
- another param: key-value request params that are passed on to the appropriate cwebp binary. Boolean values are interpreted as flag arguments (e.g.: -nostrong).
image url is:
then convert url is:
http://localhost:80/?url=https://www.baidu.com/img/bd_logo1.png
add convert param,eg:
http://localhost:80/?url=https://www.baidu.com/img/bd_logo1.png&q=1&nostrong=true&z=5
will have the effect of the following command-line being executed on the server:
cwebp -q 1 -nostrong -z 5 -o - -- -