Quantcast
Channel: Nginx Forum
Viewing all articles
Browse latest Browse all 53287

Re: Support for progressive jpeg in image_filter module

$
0
0
On Sat, Mar 16, 2013 at 12:07:26PM +0400, ivan babrou wrote:
> I added cast to int, fixed order and this is plain text version of the patch.

It's still broken [1], please find a way to send non-broken patches.

$ patch < p
patching file ngx_http_image_filter_module.c
Hunk #1 succeeded at 45 with fuzz 1 (offset -7 lines).
Hunk #2 succeeded at 144 (offset -13 lines).
patch: **** malformed patch at line 30: ngx_uint_t type, gdImagePtr img,

> diff --git a/ngx_http_image_filter_module.c b/ngx_http_image_filter_module.c
[...]
> @@ -1115,10 +1123,13 @@ ngx_http_image_out(ngx_http_request_t *r,
> ngx_uint_t type, gdImagePtr img,

[1] As you can see, your MUA split this line into two.

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

I think ngx_http_image_out() is the wrong place for this.

How's this instead?

diff --git a/src/http/modules/ngx_http_image_filter_module.c b/src/http/modules/ngx_http_image_filter_module.c
--- a/src/http/modules/ngx_http_image_filter_module.c
+++ b/src/http/modules/ngx_http_image_filter_module.c
@@ -45,6 +45,7 @@ typedef struct {
ngx_uint_t sharpen;

ngx_flag_t transparency;
+ ngx_flag_t interlace;

ngx_http_complex_value_t *wcv;
ngx_http_complex_value_t *hcv;
@@ -143,6 +144,13 @@ static ngx_command_t ngx_http_image_fil
offsetof(ngx_http_image_filter_conf_t, transparency),
NULL },

+ { ngx_string("image_filter_interlace"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_image_filter_conf_t, interlace),
+ NULL },
+
{ ngx_string("image_filter_buffer"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_conf_set_size_slot,
@@ -963,6 +971,8 @@ transparent:
gdImageSharpen(dst, sharpen);
}

+ gdImageInterlace(dst, (int) conf->interlace);
+
out = ngx_http_image_out(r, ctx->type, dst, &size);

ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -1186,6 +1196,7 @@ ngx_http_image_filter_create_conf(ngx_co
conf->jpeg_quality = NGX_CONF_UNSET_UINT;
conf->sharpen = NGX_CONF_UNSET_UINT;
conf->transparency = NGX_CONF_UNSET;
+ conf->interlace = NGX_CONF_UNSET;
conf->buffer_size = NGX_CONF_UNSET_SIZE;

return conf;
@@ -1234,6 +1245,8 @@ ngx_http_image_filter_merge_conf(ngx_con

ngx_conf_merge_value(conf->transparency, prev->transparency, 1);

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


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel

Viewing all articles
Browse latest Browse all 53287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>