如何通过Nginx实现动态生成图片缩略图功能?
- 内容介绍
- 文章标签
- 相关推荐
本文共计78个文字,预计阅读时间需要1分钟。
plaintext//Ubuntu安装libgd2-xpm-dev和build-essential//配置Nginx图片过滤器//设置图片尺寸为100x100//127.0.0.1/test.jpg
//ubuntu 需要apt-get -y install libgd2-xpm-dev build-essential //127.0.0.1/test.jpg!100!100 //--with-http_image_filter_module location ~* (.*\\.(jpg|gif|png))!(.*)!(.*)$ { set $w $3; set $h $4; image_filter resize $w $h; rewrite (.*\\.(jpg|gif|png))!(.*)!(.*)$ $1 break; image_filter resize $w $h; } location ~ .*\\.(gif|jpg|png)${ expires 30d; }
本文共计78个文字,预计阅读时间需要1分钟。
plaintext//Ubuntu安装libgd2-xpm-dev和build-essential//配置Nginx图片过滤器//设置图片尺寸为100x100//127.0.0.1/test.jpg
//ubuntu 需要apt-get -y install libgd2-xpm-dev build-essential //127.0.0.1/test.jpg!100!100 //--with-http_image_filter_module location ~* (.*\\.(jpg|gif|png))!(.*)!(.*)$ { set $w $3; set $h $4; image_filter resize $w $h; rewrite (.*\\.(jpg|gif|png))!(.*)!(.*)$ $1 break; image_filter resize $w $h; } location ~ .*\\.(gif|jpg|png)${ expires 30d; }

