Fast image resizing backend based on libvips, mozjpeg and pngquant
docker pull larrabee/reimage:1.2.5
docker run -d -p 7075:7075 larrabee/reimage:1.2.5
or use docker-compose config:version: '2.2'
services:
reImage:
image: larrabee/reimage:1.2.5
restart: always
ports:
- "7075:7075"
This is basic Nginx config for online resizing with nginx cache.
http {
proxy_cache_path /var/www/resize_cache levels=1:2
keys_zone=resized_img:64m inactive=48h max_size=5G use_temp_path=off;
server {
listen 80;
server_name example.com;
root /var/www/example.com/;
location /img/ {
location ~* \.(jpg|jpeg|png|ico)(\@[0-9xX]+)$ {
proxy_pass http://localhost:7075; #Node with running image resizer
proxy_set_header X-RESIZE-SCHEME "http";
proxy_set_header X-RESIZE-BASE "example.com";
#Nginx cache. Optional
proxy_cache_valid 200 48h;
proxy_cache_valid 404 400 5m;
proxy_cache_valid 500 502 503 504 10s;
add_header X-Cache-Status $upstream_cache_status;
proxy_cache resized_img;
}
}
}
}
Required options:
localhost:7075
with your hostname and port if you ran resizer in different node.X-RESIZE-SCHEME "http"
if your image server with original images run over http (by default use https).X-RESIZE-BASE "example.com"
Optional:
X-RESIZE-QUALITY
header if you want to override quality settings. Default value: 80, allowed values: 1-100X-RESIZE-COMPRESSION
header if you want to override compression settings. Default value: 6, allowed values: 0-9/img/test.jpg
on your serverhttp://example.com/img/test.jpg
(naturally it must be present on your server).http://example.com/img/test.jpg@1280
(height resolution will be calculate automatically)http://example.com/img/test.jpg@x720
(width resolution will be calculate automatically)http://example.com/img/test.jpg@500x500
http://example.com/img/test.jpg@500x500?fmt=webp
. Supported formats: jpeg (or jpg), png, webp, tiff.http://example.com/img/test.jpg@500x500?cmp=9
. Compression value range: from 0 to 9.http://example.com/img/test.jpg@500x500?qlt=100
. Quality value range: from 0 to 100.http://example.com/img/test.jpg@500x500?bgclr=003cfa
. Format: RGB in HEX encoding, like "ffffff" for white. Default: "000000" for none.MIT