<div dir="ltr">This patch adds support for progressive jpeg and pgn encoding with image_filter_interlace on/off setting. Google suggests to use progressive jpegs so why not with nginx?<div><br></div><div><div>diff --git a/ngx_http_image_filter_module.c b/ngx_http_image_filter_module.c</div>

<div>index b086e3c..cc44d90 100644</div><div>--- a/ngx_http_image_filter_module.c</div><div>+++ b/ngx_http_image_filter_module.c</div><div>@@ -52,6 +52,7 @@ typedef struct {</div><div>     ngx_uint_t                   offset_y;</div>

<div> </div><div>     ngx_flag_t                   transparency;</div><div>+    ngx_flag_t                   interlace;</div><div> </div><div>     ngx_http_complex_value_t    *wcv;</div><div>     ngx_http_complex_value_t    *hcv;</div>

<div>@@ -142,6 +143,13 @@ static ngx_command_t  ngx_http_image_filter_commands[] = {</div><div>       0,</div><div>       NULL },</div><div> </div><div>+   { ngx_string("image_filter_interlace"),</div><div>+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,</div>

<div>+      ngx_conf_set_flag_slot,</div><div>+      NGX_HTTP_LOC_CONF_OFFSET,</div><div>+      offsetof(ngx_http_image_filter_conf_t, interlace),</div><div>+      NULL },</div><div>+</div><div>     { ngx_string("image_filter_sharpen"),</div>

<div>       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,</div><div>       ngx_http_image_filter_sharpen,</div><div>@@ -1115,10 +1123,13 @@ ngx_http_image_out(ngx_http_request_t *r, ngx_uint_t type, gdImagePtr img,</div>

<div> </div><div>     out = NULL;</div><div> </div><div>+    conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);</div><div>+</div><div>+    gdImageInterlace(img, conf->interlace);</div><div>+</div><div>

     switch (type) {</div><div> </div><div>     case NGX_HTTP_IMAGE_JPEG:</div><div>-        conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);</div><div> </div><div>         jq = ngx_http_image_filter_get_value(r, conf->jqcv, conf->jpeg_quality);</div>

<div>         if (jq <= 0) {</div><div>@@ -1237,6 +1248,7 @@ ngx_http_image_filter_create_conf(ngx_conf_t *cf)</div><div>     conf->sharpen = NGX_CONF_UNSET_UINT;</div><div>     conf->angle = NGX_CONF_UNSET_UINT;</div>

<div>     conf->transparency = NGX_CONF_UNSET;</div><div>+    conf->interlace = NGX_CONF_UNSET;</div><div>     conf->buffer_size = NGX_CONF_UNSET_SIZE;</div><div>     conf->offset_x = NGX_CONF_UNSET_UINT;</div>

<div>     conf->offset_y = NGX_CONF_UNSET_UINT;</div><div>@@ -1292,6 +1304,8 @@ ngx_http_image_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)</div><div> </div><div>     ngx_conf_merge_value(conf->transparency, prev->transparency, 1);</div>

<div> </div><div>+    ngx_conf_merge_value(conf->interlace, prev->interlace, 0);</div><div>+</div><div>     ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size,</div><div>                               1 * 1024 * 1024);</div>

<div> </div><div><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></div></div>