Giter Site home page Giter Site logo

haanico / webp_server_go Goto Github PK

View Code? Open in Web Editor NEW

This project forked from webp-sh/webp_server_go

0.0 1.0 0.0 7.64 MB

Go version of WebP Server. A tool that will serve your JPG/PNGs as WebP format with compression, on-the-fly.

Home Page: https://webp.sh/

License: GNU General Public License v3.0

Go 95.69% Makefile 1.01% Shell 0.95% Dockerfile 2.35%

webp_server_go's Introduction

CI build docker image Release WebP Server Go Binaries codecov

Documentation | Website

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)

e.g When you visit https://your.website/pics/tsuki.jpg,it will serve as image/webp format without changing the URL.

For Safari and Opera users, the original image will be used. We've now support Safari/Chrome/Firefox on iOS 14/iPadOS 14

Simple Usage Steps

1. Download or build the binary

Download the webp-server from release page.

2. Dump config file

./webp-server -dump-config > config.json

The default config.json may look like this.

{
  "HOST": "127.0.0.1",
  "PORT": "3333",
  "QUALITY": "80",
  "IMG_PATH": "/path/to/pics",
  "EXHAUST_PATH": "/path/to/exhaust",
  "ALLOWED_TYPES": ["jpg","png","jpeg","bmp"],
  "ENABLE_AVIF": false
}

Config Example

In the following example, the image path and website URL.

Image Path Website Path
/var/www/img.webp.sh/path/tsuki.jpg https://img.webp.sh/path/tsuki.jpg

The config.json should be like:

IMG_PATH
/var/www/img.webp.sh

EXHAUST_PATH is cache folder for output webp images, with EXHAUST_PATH set to /var/cache/webp in the example above, your webp image will be saved at /var/cache/webp/pics/tsuki.jpg.1582558990.webp.

3. Run

./webp-server --config=/path/to/config.json

4. Nginx proxy_pass

Let Nginx to proxy_pass http://localhost:3333/;, and your webp-server is on-the-fly.

Advanced Usage

For supervisor, Docker sections, please read our documentation at https://docs.webp.sh/

License

WebP Server is under the GPLv3. See the LICENSE file for details.

webp_server_go's People

Contributors

bennythink avatar n0vad3v avatar muzi502 avatar bluecocoa avatar knifec avatar mathieu-aubin avatar yinixu9506 avatar dependabot[bot] avatar

Watchers

James Cloos 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.