Giter VIP home page Giter VIP logo

ngx-http-gm-module's Introduction

nginx http graphicsmagick module

nginx handler模块,访问图片文件时,根据配置自动生成缩略图

安装

  • 安装GraphicsMagick

  • nginx源代码目录下执行

     ./configure --prefix=/usr/local/nginx-1.4.1 --add-module=/home/zhaodj/source/ngx-http-gm-module
    

    --add-module参数为此项目路径

     sudo make & sudo make install
    

配置

  • 在nginx配置文件中对应的location下添加如下配置

     gm_convert on;
     gm_allow 400 300;
     gm_allow 800 600;
    
    • gm_convert 为是否启用自动生成功能
    • gm_allow 为允许的缩略图尺寸,分别为宽和高
  • 缩略图命名规则:原图http://{host}/img/name.jpg,缩略图访问时使用http://{host}/img/name.jpg.400x300.jpg

  • nginx工作进程默认以nobody用户运行,修改nginx配置设置工作进程用户及用户组,或者将图片目录设置为nobody可写

TODO

  • gm命令path配置
  • 自动识别文件扩展名

参考

ngx-http-gm-module's People

Contributors

zhaodj avatar

Watchers

James Cloos avatar Richard Kuang 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.