Coder Social home page Coder Social logo

nginx_image_filter's Introduction

nginx image_filter

This is basically the same image_filter module, but with ability to place cropped images.

Goals

Humans usually have faces at the top of their photos, but nginx always crop image to center. We needed to make it more flexible.

Configuration

This module has additional configuration option:

image_filter_crop_offset {left,center,right} {top,center,bottom};

build

download nginx source,override the ngx_http_image_filter_module.c

  • nginx installed
nginx -V
./configure // copy config from nginx-v
make

replace objs/modules/ngx_http_image_filter_module.so

  • nginx not installed
./configure --with-http_image_filter_module=dynamic
// other configs
make && make install

Examples

conf

example conf

http://localhost:8888/crop/768/example.jpg

Vertical images

  • Original image

Original vertical image

  • Crop and align to top: image_filter_crop_offset center top;

Aligned to top vertical image

  • Crop and align to center (original behavior): image_filter_crop_offset center center;

Aligned to center vertical image

  • Crop and align to bottom: image_filter_crop_offset center bottom;

Aligned to bottom vertical image

Horizontal images

  • Original image

Original horizontal image

  • Crop and align to left: image_filter_crop_offset left center;

Aligned to left horizontal image

  • Crop and align to center (original behavior): image_filter_crop_offset center center;

Aligned to center horizontal image

  • Crop and align to right: image_filter_crop_offset right center;

Aligned to right horizontal image

ChangLog

2019/10/15 base on nginx 1.13.0/src/http/modules/ngx_http_image_filter_module.c,works on nginx-1.10.3 above

Authors

nginx_image_filter's People

Contributors

bobrik avatar zengde 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.