Files
resty_functions/test/test_magick.lua
T
木逸辰 a0fdd62319 use nginx variable to get magick (#20)
* use nginx variable to get magick

* remove comments
2021-09-12 11:01:41 +08:00

29 lines
751 B
Lua

-- read from nginx var config
local magick = ngx.var.magick
ngx.log(ngx.ERR, 'var', magick)
-- or use which command to get
if not magick then
local exec = io.popen("which magick")
local tmp = exec:read("*a")
magick = string.gsub(tmp, "%s+", "")
exec:close()
end
if not magick then
ngx.status = 500
ngx.say("image magick not found.")
return
end
ngx.say(magick)
--local origin = {
-- "/Users/moicen/Music/alchemy/Song-of-joy.png",
-- "/Users/moicen/Music/alchemy/You-and-me.png"
--}
--origin = table.concat(origin, " ")
--ngx.log(ngx.ERR, origin)
--local file = io.popen("/usr/local/bin/magick convert -append " .. origin .. " /tmp/combined.jpeg" )
--local output = file:read("*all")
--file:close()
--ngx.say(output)