change to PNG

This commit is contained in:
2022-08-22 23:59:02 +08:00
parent ae5a0c0337
commit 980fec142f
3 changed files with 7 additions and 5 deletions
+5 -3
View File
@@ -13,7 +13,7 @@ ngx.log(ngx.INFO, 'REQ_BODY -> ', ngx.req.get_body_data())
local data = req_body["payload"]["images"]
local combined_uuid = uuid.generate_v4()
local combined = file_dir .. "/" .. combined_uuid .. ".jpeg";
local combined = file_dir .. "/" .. combined_uuid .. ".png";
local len = table.getn(data)
if len == 0 then
@@ -24,7 +24,9 @@ end
local origin = {}
for i = 1, len do
ngx.log(ngx.INFO, "COMBINE FILE ->", data[i])
origin[i] = file_dir .. "/" .. data[i] .. " "
local cmd = convert .. " -resize 1280x " .. data[i] .. " " .. data[i] .. ".png"
ngx.log(ngx.INFO, 'CMD RESIZE -> ', cmd)
origin[i] = file_dir .. "/" .. data[i] .. ".png "
end
-- 从 nginx 变量取
local convert = ngx.var.convert
@@ -36,7 +38,7 @@ if not convert then
end
local cmd = convert .. " -append " .. table.concat(origin, " ") .. " " .. combined
ngx.log(ngx.INFO, 'CMD -> ', cmd)
ngx.log(ngx.INFO, 'CMD APPEND -> ', cmd)
io.popen(cmd)
ngx.say(combined_uuid)