Code Monkey home page Code Monkey logo

nginx-qoi's Introduction

ngix-qoi

This nginx module converts qoi images on the fly and sends a png response.

qoi image format: https://github.com/phoboslab/qoi

Dependency

qoi header.

  • qoi.h

stb header.

  • stb_image.h
  • stb_image_write.h

Installation

Build.

$ : "clone repository"
$ git clone https://xxx/nginx-qoi
$ cd nginx-qoi
$ : "get nginx source"
$ NGINX_VERSION=1.x.x # specify nginx version
$ wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
$ tar -zxf nginx-${NGINX_VERSION}.tar.gz
$ cd nginx-${NGINX_VERSION}
$ : "build module"
$ ./configure --add-dynamic-module=${PWD}/../
$ make && make install

Edit nginx.conf and load the required modules.

load_module modules/ngx_http_qoi_module.so;

Synopsis

http {
  location ~ ".qoi" { qoi; }
}

Test

Using the perl of Test::Nginx module to testing.

$ cpan -Ti Test::Nginx
$ export TEST_NGINX_HTML_DIR=${PWD}/t/html
$ export TEST_NGINX_LOAD_MODULES=${PWD}/nginx-${NGINX_VERSION}/objs/ngx_http_qoi_module.so
$ prove -r t
t/001.t .. ok
All tests successful.
Files=1, Tests=2,  0 wallclock secs ( 0.01 usr  0.00 sys +  0.11 cusr  0.02 csys =  0.14 CPU)
Result: PASS

Example

$ curl -I http://localhost/qoi_logo.qoi
HTTP/1.1 200 OK
Server: nginx/1.20.2
Date: Fri, 21 Jan 2022 03:31:56 GMT
Content-Length: 20210
Last-Modified: Fri, 21 Jan 2022 03:31:56 GMT
Connection: keep-alive
Content-Type: image/png

nginx-qoi's People

Contributors

kjdev avatar

Stargazers

Georgy Shelkovy 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.