Mercurial > hg > nginx
changeset 4981:5889bc5f7a65
Image filter: fixed image_filter rotate inheritance.
Configurations like
location /i/ {
image_filter resize 200 200;
image_filter rotate 180;
location /i/foo/ {
image_filter resize 200 200;
}
}
resulted in rotation incorrectly applied in the location /i/foo, without
any way to clear it. Fix is to handle conf->angle/conf->acv consistently
with other filter variables and do not try to inherit them if there are
transformations defined for current location.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 21 Dec 2012 15:07:45 +0000 |
parents | f091722acab4 |
children | 6ccd3a50b40f |
files | src/http/modules/ngx_http_image_filter_module.c |
diffstat | 1 files changed, 15 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_image_filter_module.c Fri Dec 21 08:46:52 2012 +0000 +++ b/src/http/modules/ngx_http_image_filter_module.c Fri Dec 21 15:07:45 2012 +0000 @@ -1169,10 +1169,22 @@ return NULL; } + /* + * set by ngx_pcalloc(): + * + * conf->width = 0; + * conf->height = 0; + * conf->angle = 0; + * conf->wcv = NULL; + * conf->hcv = NULL; + * conf->acv = NULL; + * conf->jqcv = NULL; + * conf->shcv = NULL; + */ + conf->filter = NGX_CONF_UNSET_UINT; conf->jpeg_quality = NGX_CONF_UNSET_UINT; conf->sharpen = NGX_CONF_UNSET_UINT; - conf->angle = NGX_CONF_UNSET_UINT; conf->transparency = NGX_CONF_UNSET; conf->buffer_size = NGX_CONF_UNSET_SIZE; @@ -1195,8 +1207,10 @@ conf->filter = prev->filter; conf->width = prev->width; conf->height = prev->height; + conf->angle = prev->angle; conf->wcv = prev->wcv; conf->hcv = prev->hcv; + conf->acv = prev->acv; } } @@ -1218,14 +1232,6 @@ } } - if (conf->angle == NGX_CONF_UNSET_UINT) { - ngx_conf_merge_uint_value(conf->angle, prev->angle, 0); - - if (conf->acv == NULL) { - conf->acv = prev->acv; - } - } - ngx_conf_merge_value(conf->transparency, prev->transparency, 1); ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,