Coder Social home page Coder Social logo

ngx_http_avatars_gen_module's Introduction

ngx_http_avatars_gen_module

Say Thanks!

Nginx module to generate gmail-like avatars based on user initials.

Dependencies

Module requires libcairo:

sudo apt-get install libcairo2 libcairo2-dev

Installation

To install module you should compile nginx with it:

cd nginx-1.11.3/
./configure --add-module=/path/to/module/avatars_gen
make && sudo make install

Configuration

Module could be enabled on location context:

http {
    server {
        listen       80;
        server_name  localhost;

        # Default params
        location /avatar {
            avatars_gen;
        }

        # Black & white avatar
        location /bw-avatar {
            avatars_gen;
            avatars_gen_bg_color FFFFFF;
            avatars_gen_contour_color 000000;
            avatars_gen_font_color 000000;
            avatars_gen_font_face serif;
        }

        # Custom size and without contour
        location /big-contourless {
            avatars_gen;
            avatars_gen_size 400;
            avatars_gen_show_contour off;
        }

        # Customized font
        location /font {
            avatars_gen;
            avatars_gen_size 300;
            avatars_gen_font_size 100;
            avatars_gen_font_face "Liberation Sans Narrow";
            avatars_gen_font_bold on;
        }

        # Square form
        location /square {
            avatars_gen;
            avatars_gen_square on;
            avatars_gen_bg_color 72A3F1;
            avatars_gen_contour_color E9AD00;
            avatars_gen_font_color 9BFAB5;
            avatars_gen_size 100;
            avatars_gen_font_face "Liberation Sans";
            avatars_gen_show_contour off;
        }
    }
}

Directives:

  • avatars_gen - enables avatars generation on this location
  • avatars_gen_bg_color (default: 4285f5) - background color of avatar
  • avatars_gen_contour_color (default: 333333) - circle contour color
  • avatars_gen_font_color (default: FFFFFF) - font color
  • avatars_gen_font_face (default: sans) - font-face name
  • avatars_gen_font_size (default: avatars_gen_size / 2) - font size in pixels
  • avatars_gen_size (default: 100) - avatar size in pixels
  • avatars_gen_show_contour (default: on) - show/hide contour
  • avatars_gen_font_italic (default: off) - italic font on/off
  • avatars_gen_font_bold (default: off) - bold font on/off
  • avatars_gen_square (default: off) - square avatars on/off

You could change avatar colors with GET args (i.e. ?bg_color=FFFFFF&font_color=000000):

  • bg_color
  • contour_color
  • font_color

Usage

You can make request to http://localhost/avatar/GH and it will generate 100x100 png image on-the-go:

Default:

default

Black & white:

black and white

Custom size and without contour:

big-contourless

Customized font:

customized font

Square form:

square

Module currently supports only 1 and 2 symbols initials.

TODO

  • fix HEAD method
  • default settings
  • unicode initials
  • avatars size configuration
  • enable/disable border
  • rich font settings
  • square avatars
  • colors configuration through GET parameters
  • random colors mode
  • different formats (jpg/svg)
  • configurations merge

License

The MIT License (MIT)

Copyright (c) 2016 Yuri Shikanov

ngx_http_avatars_gen_module's People

Contributors

dizballanze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ngx_http_avatars_gen_module's Issues

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.