手机版
你好,游客 登录 注册
背景:
阅读新闻

Nginx图片剪裁模块探究 http_image_filter_module

[日期:2013-11-30] 来源:Linux社区  作者:cwtea [字体:大 中 小]

官方地址:http://nginx.org/en/docs/http/ngx_http_image_filter_module.html

煮酒品茶:前半部安装和官方说明,后半部分实践

#yum install -y gd-devel

 

Install add http_image_filter_module Module

#./configure --prefix=/usr/local/nginx_image_filter/ --with-http_image_filter_module

#make && make install

 

use:

151237823.jpg

 

off:关闭模块处理

 

test:确保图片是jpeg gif png否则返415错误

 

size:输出有关图像的json格式:如下显示

{ "img" : { "width": 100, "height": 100, "type": "gif" } }

出错显示:

{}

 

rotate 90|180|270:旋转指定度数的图像,参数可以包括变量,单独或一起与resize crop一起使用。

 

resize width height:按比例减少图像到指定大小,公减少一个可以另一个用"-"来表示,出错415,参数值可包含变量,可以与rotate一起使用,则两个一起生效。

 

resize width height:按比例减少图像大小,其它和rotate一样。

 

crop width height:按比例减少图像比较大的侧面积和另一侧多余的载翦边缘,其它和rotate一样。没太理解

 

#设置读取图像缓冲的最大大小,超过则415错误。

syntax:image_filter_buffer size;

default:

image_filter_buffer 1M;

context:http, server, location

 

#如果启用,最终的图像将被交错。对于JPEG,最终的图像将在“渐进式JPEG”格式。

syntax:image_filter_interlace on | off;

default:

image_filter_interlace off;

context:http, server, location

This directive appeared in version 1.3.15.

 

#设置变换的JPEG图像的期望质量。可接受的值是从1到100的范围内。较小的值通常意味着既降低图像质量,减少传输数据,推荐的最大值为95。参数值可以包含变量。

syntax:image_filter_jpeg_quality quality;

default:

image_filter_jpeg_quality 75;

context:http, server, location

 

#增加了最终图像的清晰度。锐度百分比可以超过100。零值将禁用锐化。参数值可以包含变量。

syntax:image_filter_sharpen percent;

default:

image_filter_sharpen 0;

context:http, server, location

 

#定义是否应该透明转换的GIF图像或PNG图像与调色板中指定的颜色时,可以保留。透明度的损失将导致更好的图像质量。在PNG的Alpha通道总是保留透明度。

syntax:image_filter_transparency on|off;

default:

image_filter_transparency on;

context:http, server, location

 

image_filter resize width height;

Json:

151512434.png

 

品茶:这比例不知道具体怎么算的测一测。

更多详情见请继续阅读下一页的精彩内容: http://www.linuxidc.com/Linux/2013-11/93329p2.htm

推荐阅读:

Nginx实现反向代理和负载均衡的配置及优化 http://www.linuxidc.com/Linux/2013-11/92909.htm

Nginx做负载均衡报:nginx: [emerg] could not build the types_hash http://www.linuxidc.com/Linux/2013-10/92063.htm

Nginx 负载均衡模块 ngx_http_upstream_module 详述 http://www.linuxidc.com/Linux/2013-10/91907.htm

Nginx+Firebug 让浏览器告诉你负载均衡将请求分到了哪台服务器 http://www.linuxidc.com/Linux/2013-10/91824.htm

Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建) http://www.linuxidc.com/Linux/2012-10/72458.htm

Nginx 的详细介绍:请点这里
Nginx 的下载地址:请点这里

linux
相关资讯       Nginx模块  Nginx图片 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款