<div dir="ltr">Maybe you're right about moving <span style="font-family:arial,sans-serif;font-size:13px">gdImageInterlace from </span><span style="font-family:arial,sans-serif;font-size:13px">ngx_http_image_out. Should I fix something else or is it okay now?</span></div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On 16 March 2013 21:59, Ruslan Ermilov <span dir="ltr"><<a href="mailto:ru@nginx.com" target="_blank">ru@nginx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Sat, Mar 16, 2013 at 12:07:26PM +0400, ivan babrou wrote:<br>
> I added cast to int, fixed order and this is plain text version of the patch.<br>
<br>
</div>It's still broken [1], please find a way to send non-broken patches.<br>
<br>
$ patch < p<br>
patching file ngx_http_image_filter_module.c<br>
Hunk #1 succeeded at 45 with fuzz 1 (offset -7 lines).<br>
Hunk #2 succeeded at 144 (offset -13 lines).<br>
patch: **** malformed patch at line 30: ngx_uint_t type, gdImagePtr img,<br>
<br>
> diff --git a/ngx_http_image_filter_module.c b/ngx_http_image_filter_module.c<br>
[...]<br>
<div class="im">> @@ -1115,10 +1123,13 @@ ngx_http_image_out(ngx_http_request_t *r,<br>
> ngx_uint_t type, gdImagePtr img,<br>
<br>
</div>[1] As you can see, your MUA split this line into two.<br>
<div class="im"><br>
><br>
> out = NULL;<br>
><br>
> + conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);<br>
> +<br>
> + gdImageInterlace(img, (int) conf->interlace);<br>
> +<br>
<br>
</div>I think ngx_http_image_out() is the wrong place for this.<br>
<br>
How's this instead?<br>
<br>
diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c<br>
--- a/src/http/modules/ngx_http_image_filter_module.c<br>
+++ b/src/http/modules/ngx_http_image_filter_module.c<br>
@@ -45,6 +45,7 @@ typedef struct {<br>
ngx_uint_t sharpen;<br>
<div class="im"><br>
ngx_flag_t transparency;<br>
+ ngx_flag_t interlace;<br>
<br>
ngx_http_complex_value_t *wcv;<br>
ngx_http_complex_value_t *hcv;<br>
</div>@@ -143,6 +144,13 @@ static ngx_command_t ngx_http_image_fil<br>
<div class="im"> offsetof(ngx_http_image_filter_conf_t, transparency),<br>
NULL },<br>
<br>
+ { ngx_string("image_filter_interlace"),<br>
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,<br>
+ ngx_conf_set_flag_slot,<br>
+ NGX_HTTP_LOC_CONF_OFFSET,<br>
+ offsetof(ngx_http_image_filter_conf_t, interlace),<br>
+ NULL },<br>
+<br>
{ ngx_string("image_filter_buffer"),<br>
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,<br>
ngx_conf_set_size_slot,<br>
</div>@@ -963,6 +971,8 @@ transparent:<br>
gdImageSharpen(dst, sharpen);<br>
}<br>
<br>
+ gdImageInterlace(dst, (int) conf->interlace);<br>
+<br>
out = ngx_http_image_out(r, ctx->type, dst, &size);<br>
<br>
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,<br>
@@ -1186,6 +1196,7 @@ ngx_http_image_filter_create_conf(ngx_co<br>
conf->jpeg_quality = NGX_CONF_UNSET_UINT;<br>
conf->sharpen = NGX_CONF_UNSET_UINT;<br>
<div class="im"> conf->transparency = NGX_CONF_UNSET;<br>
+ conf->interlace = NGX_CONF_UNSET;<br>
conf->buffer_size = NGX_CONF_UNSET_SIZE;<br>
<br>
</div> return conf;<br>
@@ -1234,6 +1245,8 @@ ngx_http_image_filter_merge_conf(ngx_con<br>
<div class="HOEnZb"><div class="h5"><br>
ngx_conf_merge_value(conf->transparency, prev->transparency, 1);<br>
<br>
+ ngx_conf_merge_value(conf->interlace, prev->interlace, 0);<br>
+<br>
ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,<br>
1 * 1024 * 1024);<br>
<br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards, Ian Babrou<br><a href="http://bobrik.name" target="_blank">http://bobrik.name</a> <a href="http://twitter.com/ibobrik" target="_blank">http://twitter.com/ibobrik</a> skype:i.babrou
</div>