add download image

This commit is contained in:
李勇
2021-08-08 18:50:54 +08:00
parent 7e45f455b2
commit fb80b74de3
2 changed files with 28 additions and 0 deletions
+21
View File
@@ -4,6 +4,7 @@
* [1.图片上传](#1) * [1.图片上传](#1)
* [2.图片拼接](#2) * [2.图片拼接](#2)
* [4.图片下载](#3)
------ ------
## 前置安装 ## 前置安装
@@ -216,6 +217,26 @@ location /image_append {
└── image_append.lua └── image_append.lua
``` ```
<h2 id="3">3.图片下载</h2>
- music-room配置
```nginx configuration
# 子域名配置文件路径
# /usr/local/openresty/nginx/conf.d/music-room.conf
# server contex 中添加location
#Donwload image use ngx.exec
location /download_image2 {
content_by_lua_file /usr/local/openresty/nginx/conf/lua/download_image2.lua;
}
```
- 添加lua脚本
```bash
/usr/local/openresty/resty_funcs
.
└── download_image.lua
```
+7
View File
@@ -0,0 +1,7 @@
-- Get download image id
local download_image_id = string.match(ngx.var.request_uri, ".*/(.*)$")
ngx.log(ngx.INFO , "Download image id: " .. download_image_id)
-- Set redirect uri
local uri = "/internal_file_upload/" .. download_image_id .. ".jpg"
return ngx.exec(uri)