From 4fa3dd0760140605c15d630be83c5eb7455f1556 Mon Sep 17 00:00:00 2001 From: moicen Date: Thu, 30 Dec 2021 00:46:59 +0800 Subject: [PATCH] remove magick variable, use convert for all platform --- combine.lua | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/combine.lua b/combine.lua index 9ee5453..3f29af1 100644 --- a/combine.lua +++ b/combine.lua @@ -1,5 +1,5 @@ -local uuid = require "resty.jit-uuid" -local cjson = require "cjson" +local uuid = require "resty.jit-uuid" +local cjson = require "cjson" uuid.seed() local file_dir = ngx.var.tmp_file_dir @@ -12,27 +12,23 @@ local len = table.getn(data) if len == 0 then ngx.status = 500 ngx.log(ngx.ERR, "No images to combine!") - return; + return ; end local origin = {} for i = 1, len do - ngx.log(ngx.INFO, "COMBINE FILE ->", data[i]) + ngx.log(ngx.INFO, "COMBINE FILE ->", data[i]) origin[i] = file_dir .. "/" .. data[i] .. " " end -- ไปŽ nginx ๅ˜้‡ๅ– -local magick = ngx.var.magick local convert = ngx.var.convert -if not magick then - if not convert then - ngx.status = 500 - ngx.log(ngx.ERR, "ImageMagick NOT FOUND.") - return - end - magick = "" +if not convert then + ngx.status = 500 + ngx.log(ngx.ERR, "ImageMagick NOT FOUND.") + return end -local cmd = magick .. " " .. convert .. " -append " .. table.concat(origin, " ") .. " " .. combined +local cmd = convert .. " -append " .. table.concat(origin, " ") .. " " .. combined ngx.log(ngx.INFO, 'CMD -> ', cmd) local result, _, code = os.execute(cmd) if result and code == 0 then