# HG changeset patch # User Maxim Dounin # Date 1335034941 0 # Node ID 084137d883ecf0f85404ff4ef081c95ce6830633 # Parent f1a7633b20a4219a4cda9d5e36bfae624c49d9a9 Image filter: compare aspect ratio more accurately during crop. Previously used fixed-point calculation caused wrong code path selection in some cases, resulting in incorrect image size. See here for report: http://mailman.nginx.org/pipermail/nginx-devel/2012-April/002123.html diff -r f1a7633b20a4 -r 084137d883ec src/http/modules/ngx_http_image_filter_module.c --- a/src/http/modules/ngx_http_image_filter_module.c Thu Apr 19 15:48:03 2012 +0000 +++ b/src/http/modules/ngx_http_image_filter_module.c Sat Apr 21 19:02:21 2012 +0000 @@ -817,9 +817,7 @@ resize = 0; - if ((ngx_uint_t) (dx * 100 / dy) - < ctx->max_width * 100 / ctx->max_height) - { + if ((double) dx / dy < (double) ctx->max_width / ctx->max_height) { if ((ngx_uint_t) dx > ctx->max_width) { dy = dy * ctx->max_width / dx; dy = dy ? dy : 1;