Files
resty_functions/test/test_magick.lua
T

29 lines
751 B
Lua
Raw Normal View History

2021-09-12 11:01:41 +08:00
-- 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()
2021-09-06 18:56:59 +08:00
end
2021-09-12 11:01:41 +08:00
if not magick then
ngx.status = 500
ngx.say("image magick not found.")
return
end
ngx.say(magick)
2021-09-06 18:56:59 +08:00
--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)