use nginx variable to get magick (#20)
* use nginx variable to get magick * remove comments
This commit is contained in:
+17
-8
@@ -1,12 +1,21 @@
|
||||
local magick = "/usr/local/ImageMagick/bin/magick"
|
||||
local tmp = io.open(magick,"r")
|
||||
if tmp == nil then
|
||||
-- in mac os
|
||||
magick = "/usr/local/bin/magick"
|
||||
else
|
||||
io.close(tmp)
|
||||
-- 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
|
||||
print(magick)
|
||||
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",
|
||||
|
||||
Reference in New Issue
Block a user