From ee53eac7548dc0c07114ca33aef3f6ded56e9f4a Mon Sep 17 00:00:00 2001 From: weli Date: Fri, 28 Jul 2023 03:06:30 +0800 Subject: [PATCH] fix combine filename --- scripts/check_file.lua | 2 +- scripts/combine.lua | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/check_file.lua b/scripts/check_file.lua index 4962bf8..bcb0fc6 100644 --- a/scripts/check_file.lua +++ b/scripts/check_file.lua @@ -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)) diff --git a/scripts/combine.lua b/scripts/combine.lua index 85b4f26..1daac9e 100644 --- a/scripts/combine.lua +++ b/scripts/combine.lua @@ -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)