use nginx variable to get magick (#20)

* use nginx variable to get magick

* remove comments
This commit is contained in:
木逸辰
2021-09-12 11:01:41 +08:00
committed by GitHub
parent fa8dea9e03
commit a0fdd62319
3 changed files with 25 additions and 16 deletions
+7 -8
View File
@@ -13,14 +13,13 @@ local origin = {}
for i = 1, len do
origin[i] = file_dir .. "/" .. data[i] .. " "
end
-- linux
local magick = "/usr/local/ImageMagick/bin/magick"
local tmp = io.open(magick,"r")
if tmp == nil then
-- mac os
magick = "/usr/local/bin/magick"
else
io.close(tmp)
-- 从 nginx 变量取
local magick = ngx.var.magick
if not magick then
ngx.status = 500
ngx.say("image magick not found.")
return
end
local result, _, code = os.execute(magick .. " convert -append " .. table.concat(origin, " ") .. " " .. combined)