refactor
This commit is contained in:
@@ -41,7 +41,6 @@ server {
|
|||||||
return 200;
|
return 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
location /api/ngx/image/check {
|
location /api/ngx/image/check {
|
||||||
content_by_lua_file $resty_loc/nginx/scripts/check_file.lua;
|
content_by_lua_file $resty_loc/nginx/scripts/check_file.lua;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -21,12 +21,12 @@ local file_dir = ngx.var.tmp_file_dir
|
|||||||
ngx.req.read_body()
|
ngx.req.read_body()
|
||||||
local req_body = cjson.decode(ngx.req.get_body_data())
|
local req_body = cjson.decode(ngx.req.get_body_data())
|
||||||
ngx.log(ngx.INFO, 'REQ_BODY -> ', 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_uuid = uuid.generate_v4()
|
||||||
local combined = file_dir .. "/" .. combined_uuid .. ".png";
|
local combined = file_dir .. "/" .. combined_uuid .. ".png";
|
||||||
|
|
||||||
local len = table.getn(data)
|
local len = table.getn(images)
|
||||||
if len == 0 then
|
if len == 0 then
|
||||||
ngx.status = 500
|
ngx.status = 500
|
||||||
ngx.log(ngx.ERR, "No images to combine!")
|
ngx.log(ngx.ERR, "No images to combine!")
|
||||||
@@ -45,8 +45,8 @@ if not convert then
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, len do
|
for i = 1, len do
|
||||||
ngx.log(ngx.INFO, "COMBINE FILE -> ", data[i])
|
ngx.log(ngx.INFO, "COMBINE FILE -> ", images[i])
|
||||||
incoming = file_dir .. "/" .. data[i]
|
incoming = file_dir .. "/" .. images[i]
|
||||||
origin[i] = incoming .. ".png "
|
origin[i] = incoming .. ".png "
|
||||||
local cmd = convert .. " -resize 1280x " .. incoming .. " " .. origin[i]
|
local cmd = convert .. " -resize 1280x " .. incoming .. " " .. origin[i]
|
||||||
ngx.log(ngx.INFO, 'CMD RESIZE -> ', cmd)
|
ngx.log(ngx.INFO, 'CMD RESIZE -> ', cmd)
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ local function create_task(httpc, task_text, authHeader, sudoerToken)
|
|||||||
ngx.log(ngx.INFO, 'remote_url -> ', remote_url)
|
ngx.log(ngx.INFO, 'remote_url -> ', remote_url)
|
||||||
ngx.log(ngx.INFO, 'Authorization -> ', authHeader)
|
ngx.log(ngx.INFO, 'Authorization -> ', authHeader)
|
||||||
ngx.log(ngx.INFO, 'HtySudoerToken -> ', sudoerToken)
|
ngx.log(ngx.INFO, 'HtySudoerToken -> ', sudoerToken)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ngx.log(ngx.INFO, 'UPLOAD_PICTURE *body_text* ->', task_text)
|
ngx.log(ngx.INFO, 'UPLOAD_PICTURE *body_text* ->', task_text)
|
||||||
local res, err = httpc:request_uri(
|
local res, err = httpc:request_uri(
|
||||||
remote_url,
|
remote_url,
|
||||||
|
|||||||
Reference in New Issue
Block a user