diff --git a/scripts/combine.lua b/scripts/combine.lua index c0c39e9..29a4273 100644 --- a/scripts/combine.lua +++ b/scripts/combine.lua @@ -21,13 +21,9 @@ if len == 0 then ngx.log(ngx.ERR, "No images to combine!") return ; end + local origin = {} -for i = 1, len do - ngx.log(ngx.INFO, "COMBINE FILE ->", 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 @@ -37,6 +33,13 @@ if not convert then return end +for i = 1, len do + ngx.log(ngx.INFO, "COMBINE FILE -> ", 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 + local cmd = convert .. " -append " .. table.concat(origin, " ") .. " " .. combined ngx.log(ngx.INFO, 'CMD APPEND -> ', cmd) io.popen(cmd)