-
Notifications
You must be signed in to change notification settings - Fork 80
Home
ngx_small_light is a dynamic image transformation module for Nginx. And ngx_small_light is written for using as the same way as mod_small_light as possible in Nginx.(mod_small_light is a Apache module)
Before install ngx_small_light( and nginx), install following dependencies.
cd ${ngx_small_light_src_dir}
./setup
cd {$nginx_src_dir}
./configure --with-pcre --add-module=${ngx_small_light_src_dir}
make
sudo make install
If you want to enable the libraries expect ImageMagick in ngx_small_light, add following options when executing setup. (ImageMagick is always enabled)
./setup --with-imlib2 # enable ImageMagick and Imlib2
./setup --with-gd # enable ImageMagick and GD
./setup --with-imlib2 --with-gd # enable ImageMagick and Imlib2 and GD
Add following configuration to some server context in nginx.conf and start Nginx.
small_light on;
location ~ small_light[^/]*/(.+)$ {
set $file $1;
rewrite ^ /$file;
}
If you can get the original image of image.jpeg from following URL,
http://$host:$port/img/image.jpg
you will be able to get the converted image of image.jpeg from following URL.
http://$host:$port/small_light(dw=300,dh=300)/img/image.jpg
The configuration guide explains how to describe a configuration to nginx.conf and about configuratve parameters.
ngx_small_light supports JPEG, GIF, PNG. But the translation by Imlib2 does not support to writing GIF-image. Because Imlib2 has the function for loading GIF-image but does not have the function for saving.
So of=gif
and e=imlib2
are not enable to specify at once.
If these are specified, ngx_small_light return 415(Unsupported Media Type).