Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#1015 closed defect (invalid)

image_filter module failure to perform image_filter_jpeg_quality step

Reported by: Robert Kenny Owned by:
Priority: minor Milestone:
Component: nginx-module Version: 1.11.x
Keywords: image_filter Cc:
uname -a: Linux ip-172-31-19-164 4.2.0-41-generic #48-Ubuntu SMP Fri Jun 24 11:28:43 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx version: nginx/1.11.1

Description

When nginx is built from source to include the image_filter module as follows:

apt-get -y update

apt-get -y install imagemagick libreadline-dev libncurses5-dev libpcre3-dev libssl-dev perl make build-essential libgd2-xpm-dev

cd /usr/local/src

wget http://luajit.org/download/LuaJIT-2.0.4.tar.gz
tar -zxvf LuaJIT-2.0.4.tar.gz
cd /usr/local/src/LuaJIT-2.0.4
make
make install

cd /usr/local/src

wget https://github.com/openresty/set-misc-nginx-module/archive/v0.30.tar.gz
tar -zxvf v0.30.tar.gz

wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
tar -zxvf v0.3.0.tar.gz

wget https://github.com/openresty/lua-nginx-module/archive/v0.10.5.tar.gz
tar -zxvf v0.10.5.tar.gz

wget http://zlib.net/zlib-1.2.8.tar.gz
tar -zxvf zlib-1.2.8.tar.gz

wget http://nginx.org/download/nginx-1.11.1.tar.gz
tar -zxvf nginx-1.11.1.tar.gz

cd /usr/local/src/nginx-1.11.1

# tell nginx's build system where to find LuaJIT 2.0:
export LUAJIT_LIB=/usr/local/lib
export LUAJIT_INC=/usr/local/include/luajit-2.0

./configure --sbin-path=/usr/local/nginx/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_image_filter_module --with-http_ssl_module --with-zlib=/home/ubuntu/zlib-1.2.8 --with-ld-opt="-Wl,-rpath,/usr/local/lib" --add-module=/usr/local/src/ngx_devel_kit-0.3.0 --add-module=/usr/local/src/lua-nginx-module-0.10.5 --add-module=/usr/local/src/set-misc-nginx-module-0.30
make -j2
make install

With the following config:

worker_processes auto;

events {
    worker_connections 768;
}

http {
    charset utf-8;
    proxy_intercept_errors on;
    include       mime.types;
    default_type  application/octet-stream;

    server {
        listen       80;

        location / {
           image_filter_buffer 200M;
           image_filter_interlace on;
           image_filter_jpeg_quality $arg_q;

           proxy_pass https://raw.githubusercontent.com/guardian/grid/master/docs/images/screenshot-2015-07-03T11%3A34%3A43.jpg;
        }
    }
}

Requests for images seem not to be run through the image_filter module (i.e. there is no quality reduction). In addition attempting to perform a resize ("image_filter resize $arg_w $arg_h") causes a 415 error consistently.

Notes:

The reason for not using the 'nginx' and 'nginx-extras' packages is that I also require the lua module and set_misc. I have also attempted to build Openresty with the image_filter module (as it's a bit less fiddly than the above) with similar effects.

Change History (5)

comment:1 by Maxim Dounin, 4 years ago

Resolution: invalid
Status: newclosed

The image_filter_jpeg_quality directive isn't a step, is't a configuration option for other operations as available via the image_filter directive. An attempt to perform a resize fails if you don't specify width and height desired, try image_filter resize 100 100; instead.

comment:2 by Robert Kenny, 4 years ago

So to be clear you are stating image_filter_jpeg_quality cannot be performed in isolation - another image_filter directive must be specified? If true this is not described in the documentation:

http://nginx.org/en/docs/http/ngx_http_image_filter_module.html#image_filter_jpeg_quality

In any case as stated in the ticket also performing a resize operation fails (including explicitly setting width and height).

Last edited 4 years ago by Robert Kenny (previous) (diff)

comment:3 by Robert Kenny, 4 years ago

Resolution: invalid
Status: closedreopened

in reply to:  2 comment:4 by Maxim Dounin, 4 years ago

Resolution: invalid
Status: reopenedclosed

Replying to kenoir@…:

So to be clear you are stating image_filter_jpeg_quality cannot be performed in isolation - another image_filter directive must be specified? If true this is not described in the documentation:

Documentation says:

Sets the desired quality of the transformed JPEG images.

That is, this is a setting which applies to transformed images. Possible transformations are defined by the image_filter directive.

In any case as stated in the ticket also performing a resize operation fails (including explicitly setting width and height).

Note that as you use image_filter_jpeg_quality $arg_q; in your configuration, you also have to specify q, even if using explicitly set dimensions in the image_filter directive.

comment:5 by Robert Kenny, 4 years ago

Sets the desired quality of the transformed JPEG images.

I think the wording of the docs could be a little more explicit.

Note that as you use image_filter_jpeg_quality $arg_q; in your configuration, you also have to specify q, even if using explicitly set dimensions in the image_filter directive.

Apologies for the lack of clarity - I had tested with it set explicitly and by specifying the value as a URL parameter.

Note: See TracTickets for help on using tickets.