mirror of
https://github.com/yanue/nginx-lua-GraphicsMagick.git
synced 2025-11-26 23:35:33 +08:00
support for img which has query params
This commit is contained in:
@@ -6,15 +6,26 @@ server {
|
||||
root $root_path;
|
||||
|
||||
|
||||
location / {
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location /lua {
|
||||
default_type 'text/plain';
|
||||
content_by_lua 'ngx.say("hello, ttlsa lua")';
|
||||
}
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$args;
|
||||
|
||||
# add support for img which has query params,
|
||||
# like: xxx.jpg?a=b&c=d_750x750.jpg
|
||||
if ($args ~* "^([^_]+)_(\d+)+x(\d+)+\.(jpg|jpeg|gif|png)$") {
|
||||
set $w $2;
|
||||
set $h $3;
|
||||
set $img_ext $4;
|
||||
|
||||
# rewrite ^\?(.*)$ _${w}x${h}.$img_ext? last;
|
||||
rewrite ([^.]*).(jpg|jpeg|png|gif)$ $1.$2_${w}x${h}.$img_ext? permanent;
|
||||
}
|
||||
}
|
||||
|
||||
# set var for thumb pic
|
||||
set $upload_path /opt/uploads;
|
||||
set $img_original_root $upload_path;# original root;
|
||||
|
||||
@@ -37,25 +37,21 @@ server{
|
||||
}
|
||||
|
||||
location /pic/M00 {
|
||||
# add support for img which has query params,
|
||||
# like: xxx.jpg?a=b&c=d_750x750.jpg
|
||||
if ($args ~* "^([^_]+)_(\d+)+x(\d+)+\.(jpg|jpeg|gif|png)$"){
|
||||
set $w $2;
|
||||
set $h $3;
|
||||
set $img_ext $4;
|
||||
|
||||
# rewrite ^\?(.*)$ _${w}x${h}.$img_ext? last;
|
||||
rewrite ([^.]*).(jpg|jpeg|png|gif)$ $1.$2_${w}x${h}.$img_ext? permanent;
|
||||
}
|
||||
|
||||
alias /opt/fastdfs/pic/store0/data;
|
||||
ngx_fastdfs_module;
|
||||
}
|
||||
|
||||
location /chat/M00 {
|
||||
alias /opt/fastdfs/chat/store0/data;
|
||||
ngx_fastdfs_module;
|
||||
}
|
||||
|
||||
location /avatar/M00 {
|
||||
alias /opt/fastdfs/avatar/store0/data;
|
||||
ngx_fastdfs_module;
|
||||
}
|
||||
|
||||
location /media/M00 {
|
||||
alias /opt/fastdfs/media/store0/data;
|
||||
ngx_fastdfs_module;
|
||||
}
|
||||
|
||||
location = /favicon.ico {
|
||||
log_not_found off;
|
||||
access_log off;
|
||||
|
||||
Reference in New Issue
Block a user