mirror of
https://github.com/nginx/nginx.git
synced 2025-06-13 06:12:44 +08:00
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
This commit is contained in:
parent
e8fe3ce098
commit
8b89c882ce
@ -817,9 +817,7 @@ transparent:
|
|||||||
|
|
||||||
resize = 0;
|
resize = 0;
|
||||||
|
|
||||||
if ((ngx_uint_t) (dx * 100 / dy)
|
if ((double) dx / dy < (double) ctx->max_width / ctx->max_height) {
|
||||||
< ctx->max_width * 100 / ctx->max_height)
|
|
||||||
{
|
|
||||||
if ((ngx_uint_t) dx > ctx->max_width) {
|
if ((ngx_uint_t) dx > ctx->max_width) {
|
||||||
dy = dy * ctx->max_width / dx;
|
dy = dy * ctx->max_width / dx;
|
||||||
dy = dy ? dy : 1;
|
dy = dy ? dy : 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user