Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get 2times image size #46

Closed
osamunmun opened this issue Jul 8, 2016 · 11 comments
Closed

Get 2times image size #46

osamunmun opened this issue Jul 8, 2016 · 11 comments
Labels

Comments

@osamunmun
Copy link

I use version 0.7.0. Without dw and dh request, the image size looks like 2 times.
Maybe MagickGetImage.. in ngx_http_small_light_imagemagick.c return wrong size?

/* calc size. */
    iw = (double)MagickGetImageWidth(ictx->wand);
    ih = (double)MagickGetImageHeight(ictx->wand);
    ngx_http_small_light_calc_image_size(r, ctx, &sz, iw, ih);
  • request logs
    Attached image size is 774x432, but sw and sh is sw=1548,sh=864.
2016/07/08 04:04:10 [notice] 42#0: *16 "^" matches "/small_light(q=95,jpeghint=y,of=jpg)/img/test.jpg", client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,of=jpg)/img/test.jpg HTTP/1.0", host: "127.0.0.1:8081"
2016/07/08 04:04:10 [notice] 42#0: *16 rewritten data: "/img/test.jpg", args: "", client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,of=jpg)/img/test.jpg HTTP/1.0", host: "127.0.0.1:8081"
2016/07/08 04:04:10 [notice] 42#0: *16 size info:sx=0,sy=0,sw=10000,sh=10000,dw=9223372036854775808,dh=9223372036854775808,cw=0,ch=0,bw=0,bh=0,ix=0,iy=0 while sending to client, client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,of=jpg)/img/test.jpg HTTP/1.0", upstream: "http://172.20.10.3:4567/test.jpg", host: "127.0.0.1:8081"
2016/07/08 04:04:10 [debug] 42#0: *16 jpeg_size_opt:10000x10000
2016/07/08 04:04:10 [notice] 42#0: *16 size info:sx=0,sy=0,sw=1548,sh=864,dw=9223372036854775808,dh=9223372036854775808,cw=0,ch=0,bw=0,bh=0,ix=0,iy=0 while sending to client, client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,of=jpg)/img/test.jpg HTTP/1.0", upstream: "http://172.20.10.3:4567/test.jpg", host: "127.0.0.1:8081"

test

cubicdaiya added a commit that referenced this issue Jul 9, 2016
When destination size such as `dw` and `dh` is not set,
NGX_HTTP_SMALL_LIGHT_COORD_INVALID_VALUE(1.e+38) is used.
Usually, source size should be used.
@cubicdaiya
Copy link
Owner

Hi @osamunmun ,

Thank you for the report. I'm working at #47.

@cubicdaiya cubicdaiya added the bug label Jul 9, 2016
@osamunmun
Copy link
Author

Thanks!

cubicdaiya added a commit that referenced this issue Jul 9, 2016
bugfix: fixed strange size calculation behavior. refs #46
@cubicdaiya
Copy link
Owner

Fixed in #47.

@osamunmun
Copy link
Author

In only cw, ch params given without dw,dh case, NGX_HTTP_SMALL_LIGHT_COORD_INVALID_VALUE(1.e+38) is still used?

[notice] 23#0: *20 "^" matches "/small_light(q=95,jpeghint=y,da=s,cw=200,ch=200,of=jpg)/img/test.jpg", client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,da=s,cw=200,ch=200,of=jpg)/img/test.jpg HTTP/1.0", host: "127.0.0.1:8081"
[notice] 23#0: *20 rewritten data: "/img/test.jpg", args: "", client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,da=s,cw=200,ch=200,of=jpg)/img/test.jpg HTTP/1.0", host: "127.0.0.1:8081"
[notice] 23#0: *20 size info:sx=0,sy=0,sw=10000,sh=10000,dx=-9223372036854775808,dy=-9223372036854775808,dw=9223372036854775808,dh=9223372036854775808,cw=200,ch=200,bw=0,bh=0,ix=0,iy=0 while sending to client, client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,da=s,cw=200,ch=200,of=jpg)/img/test.jpg HTTP/1.0", upstream: "http://192.168.11.12:4567/test.jpg", host: "127.0.0.1:8081"
[notice] 23#0: *20 size info:sx=0,sy=0,sw=774,sh=432,dx=-9223372036854775808,dy=-9223372036854775808,dw=9223372036854775808,dh=9223372036854775808,cw=200,ch=200,bw=0,bh=0,ix=0,iy=0 while sending to client, client: 127.0.0.1, server: , request: "GET /small_light(q=95,jpeghint=y,da=s,cw=200,ch=200,of=jpg)/img/test.jpg HTTP/1.0", upstream: "http://192.168.11.12:4567/test.jpg", host: "127.0.0.1:8081"

cubicdaiya added a commit that referenced this issue Jul 10, 2016
…dnates. refs #46

When destination coordinates such as `dx` and `dy` are not set
or only canvas size is set, NGX_HTTP_SMALL_LIGHT_COORD_INVALID_VALUE(1.e+38) is used.
Usually, the origin coordinate should be used.
@cubicdaiya
Copy link
Owner

dw and dh are assigned after the process above. And I fixed about dx and dy in 9f89002.

cubicdaiya added a commit that referenced this issue Jul 10, 2016
cubicdaiya added a commit that referenced this issue Jul 10, 2016
…dnates. refs #46

When destination coordinates such as `dx` and `dy` are not set
or only canvas size is set, NGX_HTTP_SMALL_LIGHT_COORD_INVALID_VALUE(1.e+38) is used.
Usually, the origin coordinate should be used.
@cubicdaiya
Copy link
Owner

Sorry. As I was mistaken, 9f89002 was reverted and I re-fixed in c38e592.

@cubicdaiya
Copy link
Owner

In only cw, ch params given without dw,dh case, NGX_HTTP_SMALL_LIGHT_COORD_INVALID_VALUE(1.e+38) is still used?
dw and dh are assigned after the process above.

FYI, It's the same for dx and dy.

@osamunmun
Copy link
Author

Thank you for your quick fix.
If cw, ch params are given without dw, dh, crop start coordinate is (0, 0) not center of image.
Sorry I tried to fix this, but I cannot.

@cubicdaiya
Copy link
Owner

If cw, ch params are given without dw, dh, crop start coordinate is (0, 0) not center of image.

Usually such as the case should be rare. But it seems to be good that cropping the center by default in the such case.

@cubicdaiya
Copy link
Owner

Hi @osamunmun,

Modified the behavior in b7a4cce.

@osamunmun
Copy link
Author

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants