Coder Social home page Coder Social logo

seaweedfs-webp's Introduction

seaweedfs webp convert service


中文文档

It is a seaweedfs webp convert service with docker and golangs.

Docker

build

There are two ways to construct it, either way.

pull from docker hub

docker pull yhan219/seaweedfs-webp

build with dockerfile

docker build -t yhan219/seaweedfs-webp:1.0 .

run

docker run -d --name seaweedfs-webp -e volumeServer="http://ip:8080" -p 18080:80 yhan219/seaweedfs-webp:1.0

the param volumeServer is seaweedfs volume url

Usage

The service listens on port 18080 for GET requests on the path end with .webp. Any other path suffix, returns a 404 not found status. And then you just need add .webp suffix with your image url.Optional,add a list of key-value request params that are passed on to the appropriate cwebp binary. Boolean values are interpreted as flag arguments (e.g.: -nostrong).

Sample

image url is:

http://ip:8080/file/96,0c6b879ca3780c

then webp url is:

http://ip:18080/file/96,0c6b879ca3780c.webp

add convert param,eg:

http://ip:18080/file/96,0c6b879ca3780c.webp?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 - -- -

Advanced

In general, nginx works better in combination.

  • docker build -t yhan219/seaweedfs-webp:1.0 .
  • docker run -d --name seaweedfs-webp -e volumeServer="http://www.xxx.com" -p 18080:80 yhan219/seaweedfs-webp:1.0

nginx config eg:

serer {
    listen 80;
    server_name www.xxx.com;
    ## ...
    location /file/ {
         proxy_pass http://localhost:8080/;
    }
    location ~* \.webp$ {
                    ## cache
                    proxy_pass http://localhost:18080/;
            }
}

now image url is:

http://www.xxx.com/file/96,0c6b879ca3780c

and webp url is:

http://www.xxx.com/file/96,0c6b879ca3780c.webp

seaweedfs-webp's People

Contributors

yhan219 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.