### HttpImageFilter
**Version:** 0.7.54+
This module is a filter for transforming JPEG, GIF and PNG images. It is not enabled by default to enable it, provide this option to ./configure when building nginx:
這個模塊用來分發JPEG,GIF和PNG圖片。這個沒有默認開啟,在編譯nginx中通過./configure參數配置
~~~
--with-http_image_filter_module
~~~
libgd is required to build and run the module. We recommend using the latest version of libgd.
編譯和運行這個模塊必須安裝libgd庫。我們推薦使用最新版本的Libgd.
### Example Configuration
~~~
location /img/ {
proxy_pass http://backend;
image_filter resize 150 100;
error_page 415 = /empty;
}
?
location = /empty {
empty_gif;
}
~~~
### 指令
### image_filter
**Syntax:***image_filter (test|size|resize width height|crop width height)*
**Default:***none*
**Context:***location*
Specifies the type of transformation to apply to the image, one of the below:
詳細的圖片后綴類型如下:
- test: checking that the response is indeed an image format JPEG, GIF or PNG. Otherwise, an error 415.
測試:測試確定圖片文件的后綴格式為JPEG,GIF OR PNG。否則返回415錯誤
- size: Gives information about the image in JSON format. For example,
尺寸:返回JSON格式的圖片信息。例如:
~~~
{ "img"?: { "width": 100, "height": 100, "type": "gif" } }
~~~
Or if an error occurs,
或者如果發生錯誤,
~~~
{}
~~~
- resize: proportionally reduces the image to a specified size.
調整大小:縮略圖片到特定的尺寸
- crop: proportionally reduces the image to a specified size and trims extra edge.
切割:切割圖片到特定的尺寸和特定的分辨率
### image_filter_buffer
**Syntax:***image_filter_buffer size*
**Default:***1M*
**Context:***http, server, location*
Sets the maximum size for reading the image.
設置讀取文件的最大的尺寸
### image_filter_jpeg_quality
**Syntax:***image_filter_jpeg_quality [0...100]*
**Default:***75*
**Context:***http, server, location*
Sets the rate of loss of information when processing the images as **JPEG**. The maximum recommended value is **95**.
設置處理JPEG圖片的丟失信息率.推薦的最大值為95
### image_filter_transparency
**Syntax:***image_filter_transparency on|off*
**Default:***on*
**Context:***http, server, location*
This directive allows you to disable image transparency in GIF and palette-based PNG to improve image resampling quality.
這個指令容許你關閉GIF圖片的透明度和 PNG圖片質量
True color PNG alpha-channels are always preserved despite this setting.
真彩色PNG圖片保存忽略設定
Note: Grayscale PNG's are untested, but should be handled as truecolor PNGs.
注釋:灰度PNG圖片未被設置,但應該被作為真彩色PNG圖片處理
### References
[Original Documentation](http://sysoev.ru/nginx/docs/http/ngx_http_image_filter_module.html "http://sysoev.ru/nginx/docs/http/ngx_http_image_filter_module.html")
- 主要文檔
- Nginx功能概述
- 為什么選擇Nginx
- Nginx安裝
- 運行和控制Nginx
- 配置符號參考
- 優化 Nginx
- 常見問題(FAQ)
- 調試 nginx
- 核心模塊
- Nginx主模塊
- Nginx事件模塊
- 基本模塊
- http核心模塊
- HttpIndex模塊
- HttpAccess模塊
- HttpAuthBasic模塊
- HttpAutoindex模塊
- Browser模塊
- Charset模塊
- HttpEmptyGif模塊
- HttpFcgi模塊
- Geo模塊
- HttpGzip模塊
- HttpHeaders模塊
- HttpIndex模塊
- HttpReferer模塊
- HttpLimit zone
- HttpLimitReqest模塊
- HttpLog模塊
- map
- Memcached
- HttpProxy模塊
- HttpRewrite模塊
- HttpSSI模塊
- HttpUserId
- 其他模塊
- Addition模塊
- EmbeddedPerl
- flv
- HttpGzipStatic
- RandomIndex
- HttpGeoIP
- HttpRealIp
- HttpSSL
- StubStatus模塊
- HttpSubstitution
- HttpDav模塊
- GooglePerftools
- HttpXSLT
- HttpSecureLink
- HttpImageFilter
- mail模塊
- MailCore
- MailAuth
- MailProxy
- MailSSL
- 安裝
- nginx在windows上的安裝
- nginx在freebsd上的安裝
- nginx在ubuntu上的安裝
- nginx在fedora上的安裝
- nginx php-fpm安裝配置
- 配置示例和方法
- 完整例子
- 完整例子2
- 虛擬主機
- 負載均衡
- nginx防盜鏈
- HWLoadbalancerCheckErrors