remove magick variable, use convert for all platform
This commit is contained in:
+9
-13
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user