nginx动态缩略图

//ubuntu 需要apt-get -y install libgd2-xpm-dev build-essential
//在图片后边加上!100!100就可以访问缩略图127.0.0.1/test.jpg!100!100
//重新编译nginx加上 --with-http_image_filter_module

location ~* (.*\.(jpg|gif|png))!(.*)!(.*)$ {
    set $w     $3;
    set $h     $4;
 
            rewrite (.*\.(jpg|gif|png))!(.*)!(.*)$ $1 break;
            image_filter resize $w $h;
}
 
    location ~ .*\.(gif|jpg|png)${
            expires 30d;
    }
登录后复制

以上就是nginx动态缩略图的内容,更多相关内容请关注Work网(www.php.cn)!

09-15 17:01