Nginx Image Filter Processing module Http_image_filter_module installation configuration note
Http_image_filter_module is an integrated image processing module provided by Nginx, Support nginx-0.7.54 later version, in the site traffic is not very high disk limited do not want to generate redundant picture files, you can use it to zoom the picture, rotate the picture, verify the validity of the picture and get the picture width and picture type information, because it is the result of the instant calculation, so the site visit is not recommended to use.
Installation is still very simple, the default Httpimagefiltermodule module is not compiled into Nginx, so in configure time to specify
./configure arguments:--prefix=/usr/local/nginx--with-http_image_filter_module
The Ps:httpimagefiltermodule module needs to rely on gd-devel support and can be easily installed using Yum or Apt-get, if no return "/configure:error:the HTTP image Filter module requires the GD library. Error
Yum Install gd-develapt-get install libgd2-xpm Libgd2-xpm-dev
Make&&make install after can be configured, do the simplest configuration, first let the module can run up ^ ^
Location ~/simg/.*\.jpg$ { #proxy_pass http://10.11.11.11; #rewrite "/simg/(. *\.jpg) $"/img/$1 break; Image_filter resize ; Error_page 415 =/empty;}
Finally open Nginx, so access to the/simg/directory image, will be the height of up to 100 and the width of up to 100 by the original proportion of the interception, and output to the browser. Of course, you can also turn on the rewrite to read the source file in another directory, if not on a machine can open proxy_pass, and add rewrite.
Http_image_filter_module supports 5 types of commands:
Image_filter: Test image file Legitimacy (Image_filter test); 3 angle rotate picture (image_filter rotate 90 | 180 | 270); Output the width, height, type (image_filter size) of the picture in JSON format, the minimum edge shrinks the picture to maintain the picture integrity (resize width height), and the maximum edge to zoom the picture after the extra portion (image_filter crop [width] [height]);
Image_filter_jpeg_quality: Set the compression quality ratio for JPEG images (the official top recommendation is set to 95, but usually 75 is available);
Image_filter_buffer: Limit picture maximum read size, default is 1M;
Image_filter_transparency: The transparency of PNG images used to disable GIF and palette-based to improve image quality.
Image_filter_sharpen: this directive in nginx-1.1.8 and 1.0.11 after the increase, at present do not know what to do with, have known friends or find out what is wrong in the text of friends please leave a message to me ^ ^
Nginx Image Filter Processing module Http_image_filter_module installation configuration note