Lua, memc and image_filter, image not resized via lua

Ilja Razinkov razinkov at gmail.com
Sat Sep 15 06:55:55 UTC 2012


You may consider user lua-gd, http://ittner.github.com/lua-gd/, which
works just fine with LuaNginx
We making crop+resize+masking of user-uploaded images in lua handlers
with no problems

On Sat, Sep 15, 2012 at 10:15 AM, agentzh <agentzh at gmail.com> wrote:
> Hello!
>
> On Fri, Sep 14, 2012 at 3:22 PM, agentzh <agentzh at gmail.com> wrote:
>>
>> This is because the standard ngx_image_filter module's output filter
>> always runs *after* ngx_lua's subrequest capturing filter and there's
>> no easy way to change this order. The response body of your subrequest
>> is captured by ngx_lua *before* the ngx_image_filter's filter gets a
>> chance to run.
>>
>
> BTW, I've also just written a command-line utility named
> ngx-body-filters that can dump out all the output body filters of any
> running Nginx worker processes (on Linux) in the order they actually
> run.
>
> This tool is part of my Nginx SystemTap Toolkit:
>
>     https://github.com/agentzh/nginx-systemtap-toolkit#ngx-body-filters
>
> For example, on my side, the nginx configured with both the ngx_lua
> and ngx_image_filter modules will give me the following result:
>
>     $ ./ngx-body-filters -p 30132
>     Tracing 30132 (.../nginx/sbin/nginx)...
>
>     ngx_http_range_body_filter
>     ngx_http_copy_filter
>     ngx_output_chain
>     ngx_http_lua_capture_body_filter
>     ngx_http_image_body_filter
>     ngx_http_charset_body_filter
>     ngx_http_ssi_body_filter
>     ngx_http_postpone_filter
>     ngx_http_gzip_body_filter
>     ngx_http_chunked_body_filter
>     ngx_http_write_filter
>
>     113 microseconds elapsed in the probe handler.
>
> where my nginx worker process pid is 30132.
>
> From this output, we can see clearly that
> ngx_http_lua_capture_body_filter indeed runs before
> ngx_http_image_body_filter.
>
> So this tool is really handy in determining if there is an issue with
> the nginx output filter running order, which is often not so obvious
> for many users.
>
> Best regards,
> -agentzh
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx



-- 
с уважением, Разинков Илья



More information about the nginx mailing list