Lua, memc and image_filter, image not resized via lua

agentzh agentzh at
Fri Sep 14 22:22:45 UTC 2012


On Wed, Sep 12, 2012 at 8:02 AM, Markus Jelsma wrote:
> But we have one problem left, the images are not passed through the image filter at all when we do it via Lua.

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.

The solution is to do the image processing completely in Lua via
existing Lua libraries like lua-gd:

Or you can take advantage of LuaJIT 2.0's excellent FFI API to call
the libgd C API directly from within Lua:

Best regards,

More information about the nginx mailing list