如何通过nginx实现动态生成缩略图?

更新于
2026-09-26 07:15:33
0阅读来源:SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计94个文字,预计阅读时间需要1分钟。

如何通过nginx实现动态生成缩略图?

plaintext//Ubuntu安装libgd2-xpm-dev和构建工具//配置Nginx处理图片大小调整

127.0.0.1/test.jpg

100

如何通过nginx实现动态生成缩略图?

100

//启用http_image_filter_module模块location ~* \.(jpg|gif|png)$ { set $w 100; set $h 100; image_filter resize $w $h; rewrite (.*) .*;}

//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; }

本文共计94个文字,预计阅读时间需要1分钟。

如何通过nginx实现动态生成缩略图?

plaintext//Ubuntu安装libgd2-xpm-dev和构建工具//配置Nginx处理图片大小调整

127.0.0.1/test.jpg

100

如何通过nginx实现动态生成缩略图?

100

//启用http_image_filter_module模块location ~* \.(jpg|gif|png)$ { set $w 100; set $h 100; image_filter resize $w $h; rewrite (.*) .*;}

//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; }