diff --git a/scripts/check_file.lua b/scripts/check_file.lua index 1d15041..ff2ba91 100644 --- a/scripts/check_file.lua +++ b/scripts/check_file.lua @@ -7,7 +7,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 .. ".jpeg"; +local fullpath = file_dir .. "/" .. file_to_check .. ".png"; ngx.log(ngx.INFO, "FILE TO CHECK -> ", fullpath) ngx.say(file_exists(fullpath)) diff --git a/scripts/combine.lua b/scripts/combine.lua index c2f2b1b..c0c39e9 100644 --- a/scripts/combine.lua +++ b/scripts/combine.lua @@ -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) diff --git a/scripts/upload_combined_image.lua b/scripts/upload_combined_image.lua index fbf5efe..b6a248f 100644 --- a/scripts/upload_combined_image.lua +++ b/scripts/upload_combined_image.lua @@ -7,7 +7,7 @@ local file_to_upload = string.match(ngx.var.request_uri, ".*/(.*)") ngx.log(ngx.INFO, 'UPLOAD COMBINED IMAGE -> file to upload -> ', file_to_upload) local file_dir = ngx.var.tmp_file_dir -local fullpath = file_dir .. "/" .. file_to_upload .. ".jpeg"; +local fullpath = file_dir .. "/" .. file_to_upload .. ".png"; ngx.log(ngx.INFO, 'UPLOAD COMBINED IMAGE -> fullpath -> ', fullpath)