luci-0.9: merge r5964

This commit is contained in:
Jo-Philipp Wich 2010-03-27 22:20:14 +00:00
parent 0f888230ed
commit a124d0353a
2 changed files with 18 additions and 6 deletions

View file

@ -161,6 +161,18 @@ function statistics_render()
local span = vars.timespan or uci:get( "luci_statistics", "rrdtool", "default_timespan" ) or spans[1]
local graph = luci.statistics.rrdtool.Graph( luci.util.parse_units( span ) )
-- deliver image
if vars.img then
local l12 = require "luci.ltn12"
local png = io.open(graph.opts.imgpath .. "/" .. vars.img:gsub("%.+", "."), "r")
if png then
luci.http.prepare_content("image/png")
l12.pump.all(l12.source.file(png), luci.http.write)
png:close()
end
return
end
local plugin, instances
local images = { }

View file

@ -31,7 +31,7 @@ $Id$
<div style="text-align: center">
<% for i, img in ipairs(images) do %>
<img src="/rrdimg/<%=img%>" />
<img src="<%=REQUEST_URI%>?img=<%=img%>" />
<br />
<% end %>
</div>