企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## 概述 编译时,需要带上` —with-http_image_filter_module` ``` ./configure --prefix=/usr/local/nginx-1.19.1 --with-http_stub_status_module --with-http_realip_module --with-http_image_filter_module --with-debug ``` ``` location ~* /(\d+)\.(jpg)$ { set $h $arg_h; # 获取参数h的值 set $w $arg_w; # 获取参数 w 的值 #image_filter crop $h $w; image_filter resize $h $w;# 根据给定的长宽生成缩略图 } location ~* /(\d+)_(\d+)x(\d+)\.(jpg)$ { if ( -e $document_root/$1.$4 ) { # 判断原图是否存在 rewrite /(\d+)_(\d+)x(\d+)\.(jpg)$ /$1.$4?h=$2&w=$3 last; } return 404; } ``` 部署好后测试 `http://xxxx:12345/images/2021-01/202101250944272_500x400.png`