fix combine filename

This commit is contained in:
2023-07-28 03:06:30 +08:00
committed by 阿男
parent 6cb2faed7c
commit ee53eac754
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ end
local file_to_check = string.match(ngx.var.request_uri, ".*/(.*)")
local file_dir = ngx.var.tmp_file_dir
local fullpath = file_dir .. "/" .. file_to_check .. ".png";
local fullpath = file_dir .. "/" .. file_to_check;
ngx.log(ngx.INFO, "FILE TO CHECK -> ", fullpath)
ngx.say(file_exists(fullpath))
+4 -3
View File
@@ -24,7 +24,8 @@ ngx.log(ngx.INFO, 'REQ_BODY -> ', ngx.req.get_body_data())
local images = req_body["payload"]["images"]
local combined_uuid = uuid.generate_v4()
local combined = file_dir .. "/" .. combined_uuid .. ".jpeg";
local output_filename = combined_uuid .. ".jpeg";
local output_filepath = file_dir .. "/" .. output_filename
local len = table.getn(images)
if len == 0 then
@@ -57,7 +58,7 @@ for i = 1, len do
end
local cmd = convert .. " -append " .. table.concat(origin, " ") .. " " .. combined
local cmd = convert .. " -append " .. table.concat(origin, " ") .. " " .. output_filepath
ngx.log(ngx.INFO, 'CMD APPEND -> ', cmd)
io.popen(cmd)
ngx.say(combined_uuid)
ngx.say(output_filename)