refactor
This commit is contained in:
+4
-4
@@ -21,12 +21,12 @@ local file_dir = ngx.var.tmp_file_dir
|
||||
ngx.req.read_body()
|
||||
local req_body = cjson.decode(ngx.req.get_body_data())
|
||||
ngx.log(ngx.INFO, 'REQ_BODY -> ', ngx.req.get_body_data())
|
||||
local data = req_body["payload"]["images"]
|
||||
local images = req_body["payload"]["images"]
|
||||
|
||||
local combined_uuid = uuid.generate_v4()
|
||||
local combined = file_dir .. "/" .. combined_uuid .. ".png";
|
||||
|
||||
local len = table.getn(data)
|
||||
local len = table.getn(images)
|
||||
if len == 0 then
|
||||
ngx.status = 500
|
||||
ngx.log(ngx.ERR, "No images to combine!")
|
||||
@@ -45,8 +45,8 @@ if not convert then
|
||||
end
|
||||
|
||||
for i = 1, len do
|
||||
ngx.log(ngx.INFO, "COMBINE FILE -> ", data[i])
|
||||
incoming = file_dir .. "/" .. data[i]
|
||||
ngx.log(ngx.INFO, "COMBINE FILE -> ", images[i])
|
||||
incoming = file_dir .. "/" .. images[i]
|
||||
origin[i] = incoming .. ".png "
|
||||
local cmd = convert .. " -resize 1280x " .. incoming .. " " .. origin[i]
|
||||
ngx.log(ngx.INFO, 'CMD RESIZE -> ', cmd)
|
||||
|
||||
Reference in New Issue
Block a user