Mercurial > hg > nginx-quic
comparison src/http/modules/ngx_http_image_filter_module.c @ 5118:af155fc41deb
Image filter: the "image_filter_interlace" directive.
Patch by Ian Babrou, with minor changes.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Tue, 19 Mar 2013 08:13:48 +0000 |
parents | 5889bc5f7a65 |
children | 31932b5464f0 |
comparison
equal
deleted
inserted
replaced
5117:00e4459739ed | 5118:af155fc41deb |
---|---|
43 ngx_uint_t angle; | 43 ngx_uint_t angle; |
44 ngx_uint_t jpeg_quality; | 44 ngx_uint_t jpeg_quality; |
45 ngx_uint_t sharpen; | 45 ngx_uint_t sharpen; |
46 | 46 |
47 ngx_flag_t transparency; | 47 ngx_flag_t transparency; |
48 ngx_flag_t interlace; | |
48 | 49 |
49 ngx_http_complex_value_t *wcv; | 50 ngx_http_complex_value_t *wcv; |
50 ngx_http_complex_value_t *hcv; | 51 ngx_http_complex_value_t *hcv; |
51 ngx_http_complex_value_t *acv; | 52 ngx_http_complex_value_t *acv; |
52 ngx_http_complex_value_t *jqcv; | 53 ngx_http_complex_value_t *jqcv; |
139 { ngx_string("image_filter_transparency"), | 140 { ngx_string("image_filter_transparency"), |
140 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | 141 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
141 ngx_conf_set_flag_slot, | 142 ngx_conf_set_flag_slot, |
142 NGX_HTTP_LOC_CONF_OFFSET, | 143 NGX_HTTP_LOC_CONF_OFFSET, |
143 offsetof(ngx_http_image_filter_conf_t, transparency), | 144 offsetof(ngx_http_image_filter_conf_t, transparency), |
145 NULL }, | |
146 | |
147 { ngx_string("image_filter_interlace"), | |
148 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
149 ngx_conf_set_flag_slot, | |
150 NGX_HTTP_LOC_CONF_OFFSET, | |
151 offsetof(ngx_http_image_filter_conf_t, interlace), | |
144 NULL }, | 152 NULL }, |
145 | 153 |
146 { ngx_string("image_filter_buffer"), | 154 { ngx_string("image_filter_buffer"), |
147 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | 155 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, |
148 ngx_conf_set_size_slot, | 156 ngx_conf_set_size_slot, |
961 sharpen = ngx_http_image_filter_get_value(r, conf->shcv, conf->sharpen); | 969 sharpen = ngx_http_image_filter_get_value(r, conf->shcv, conf->sharpen); |
962 if (sharpen > 0) { | 970 if (sharpen > 0) { |
963 gdImageSharpen(dst, sharpen); | 971 gdImageSharpen(dst, sharpen); |
964 } | 972 } |
965 | 973 |
974 gdImageInterlace(dst, (int) conf->interlace); | |
975 | |
966 out = ngx_http_image_out(r, ctx->type, dst, &size); | 976 out = ngx_http_image_out(r, ctx->type, dst, &size); |
967 | 977 |
968 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 978 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
969 "image: %d x %d %d", sx, sy, colors); | 979 "image: %d x %d %d", sx, sy, colors); |
970 | 980 |
1184 | 1194 |
1185 conf->filter = NGX_CONF_UNSET_UINT; | 1195 conf->filter = NGX_CONF_UNSET_UINT; |
1186 conf->jpeg_quality = NGX_CONF_UNSET_UINT; | 1196 conf->jpeg_quality = NGX_CONF_UNSET_UINT; |
1187 conf->sharpen = NGX_CONF_UNSET_UINT; | 1197 conf->sharpen = NGX_CONF_UNSET_UINT; |
1188 conf->transparency = NGX_CONF_UNSET; | 1198 conf->transparency = NGX_CONF_UNSET; |
1199 conf->interlace = NGX_CONF_UNSET; | |
1189 conf->buffer_size = NGX_CONF_UNSET_SIZE; | 1200 conf->buffer_size = NGX_CONF_UNSET_SIZE; |
1190 | 1201 |
1191 return conf; | 1202 return conf; |
1192 } | 1203 } |
1193 | 1204 |
1232 } | 1243 } |
1233 } | 1244 } |
1234 | 1245 |
1235 ngx_conf_merge_value(conf->transparency, prev->transparency, 1); | 1246 ngx_conf_merge_value(conf->transparency, prev->transparency, 1); |
1236 | 1247 |
1248 ngx_conf_merge_value(conf->interlace, prev->interlace, 0); | |
1249 | |
1237 ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size, | 1250 ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size, |
1238 1 * 1024 * 1024); | 1251 1 * 1024 * 1024); |
1239 | 1252 |
1240 return NGX_CONF_OK; | 1253 return NGX_CONF_OK; |
1241 } | 1254 } |