Simple image web tool manipulation package - other than all., (*1)
Instalation
The best way is cloning the repo with specific branch name.
Stable releases are sown here., (*2)
git clone -b {STABLE_VERSION} https://github.com/mrcnpdlk/image-web-tool.git
Configuration
In folder config copy file config.json.dist
and rename to config.json
.
Edit file and set or delete options:
- storage
- path to the folder with pictures
- font
- path to the ttf file with font. Used as font on placeholders files.
- debug
- if TRUE no placeholder, but exception stack is shown., (*3)
Default font BlowBrush is included to the project., (*4)
Caching
For better performance for each request cache is used.
REDIS if enabled. If not FILES is used., (*5)
Request url schema
Example, (*6)
http://example.com/iwt/v1/{params}/{fileName}
params
and fileName
are passed to the api.php file., (*7)
Request Options (params
)
Option |
Description |
Values |
Notes |
w |
width |
value in px |
h |
height |
value in px |
c |
crop mode |
enum: scale,fit,fit-margin,fill |
q |
quality |
0-100 |
only JPG format supported |
r |
rotate |
angle in degrees |
bgc |
background color |
HEX format |
e |
effect |
enum: g (gamma), n (negative), gr (grayscale), c (colorize), b (blur) |
eo |
effect option |
string,int - depends on effect type, see table below |
Effect [e] |
Description |
Option [eo] |
Default |
g |
gamma |
gamma correcion |
1 |
n |
negative |
gr |
grayscale |
c |
colorize |
color in HEX format |
#FFFFFF |
b |
blur |
sigma |
1 |
Nginx Configuration
server {
listen 127.0.0.1:9081 default_server;
root API_DIR_LOCATION;
index api.php;
server_name _;
location / {
try_files $uri $uri/ /api.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
server {
## LISTEN
listen 81;
## SERVER
server_name example.com;
root ROOT_DIR;
index index.php index.html index.htm index.nginx-debian.html;
location /iwt/v1 {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
rewrite ^/iwt/v1/?(.*) /$1 break;
access_log /var/log/nginx/iwt-access.log;
error_log /var/log/nginx/iwt-error.log;
proxy_pass http://127.0.0.1:9081;
proxy_redirect off;
}
Examples
/h_100/demo.jpg
Height is set. Default FIT crop mode is enabled., (*8)
, (*9)
/h_200,e_b,eo_5/demo.jpg
Blur effect., (*10)
, (*11)
/h_200,e_b,eo_5/demo.jpg
Colorization effect with pink color., (*12)
, (*13)
/h_200,e_n/demo.jpg
Negative effect., (*14)
, (*15)
/h_200,q_2/demo.jpg
Less quality., (*16)
, (*17)
/h_200,w_200,c_fill/demo.jpg
FILL mode., (*18)
, (*19)
/h_200,w_200,c_fit/demo.jpg
FIT mode., (*20)
, (*21)
/h_200,w_200,c_fit-margin/demo.jpg
FIT MARGIN mode., (*22)
, (*23)
/h_200,w_200,r_20/demo.jpg
ROTATE mode., (*24)
, (*25)
/w_200,h_100/demo.jpg
File not found. Placeholder is shown., (*26)
, (*27)
/w_200,h_100/demo.jpg
Placeholder is shown., (*28)
, (*29)