From fd8b7d2f338257861e7f656563f6673dfe90cddb Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 19 Mar 2013 08:13:48 +0000 Subject: [PATCH] Image filter: the "image_filter_interlace" directive. Patch by Ian Babrou, with minor changes. --- src/http/modules/ngx_http_image_filter_module.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c index 1550aeecb..c6c3b747a 100644 --- a/src/http/modules/ngx_http_image_filter_module.c +++ b/src/http/modules/ngx_http_image_filter_module.c @@ -45,6 +45,7 @@ typedef struct { ngx_uint_t sharpen; ngx_flag_t transparency; + ngx_flag_t interlace; ngx_http_complex_value_t *wcv; ngx_http_complex_value_t *hcv; @@ -143,6 +144,13 @@ static ngx_command_t ngx_http_image_filter_commands[] = { offsetof(ngx_http_image_filter_conf_t, transparency), NULL }, + { ngx_string("image_filter_interlace"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_image_filter_conf_t, interlace), + NULL }, + { ngx_string("image_filter_buffer"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_size_slot, @@ -963,6 +971,8 @@ transparent: gdImageSharpen(dst, sharpen); } + gdImageInterlace(dst, (int) conf->interlace); + out = ngx_http_image_out(r, ctx->type, dst, &size); ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, @@ -1186,6 +1196,7 @@ ngx_http_image_filter_create_conf(ngx_conf_t *cf) conf->jpeg_quality = NGX_CONF_UNSET_UINT; conf->sharpen = NGX_CONF_UNSET_UINT; conf->transparency = NGX_CONF_UNSET; + conf->interlace = NGX_CONF_UNSET; conf->buffer_size = NGX_CONF_UNSET_SIZE; return conf; @@ -1234,6 +1245,8 @@ ngx_http_image_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child) ngx_conf_merge_value(conf->transparency, prev->transparency, 1); + ngx_conf_merge_value(conf->interlace, prev->interlace, 0); + ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size, 1 * 1024 * 1024);