Image file handler.
local SERVICE = {}
SERVICE.Name = "Image"
SERVICE.IsTimed = true
function SERVICE:Match( url )
MsgN(url.encoded)
return string.match( url.encoded, "http" ) && (string.match( url.encoded, "jpg") or string.match( url.encoded, "png") or string.match( url.encoded, "bmp") or string.match( url.encoded, "jpeg") or string.match( url.encoded, "gif") )
end
function SERVICE:GetURLInfo( url )
local info = {}
MsgN("Grabbing image data...")
PrintTable(url)
info.Data = url.encoded
return info
end
function SERVICE:GetVideoInfo( data, onSuccess, onFailure )
local info = {}
info.thumbnail = data
info.title = "Image"
info.duration = 60
if onSuccess then
PrintTable(info)
pcall(onSuccess, info)
end
end
theater.RegisterService( 'Image', SERVICE )
if CLIENT then
function SERVICE:LoadVideo( Video, panel )
local panel = theater.ActivePanel()
panel:Stop()
panel:OpenURL( Video:Data() )
end
end
May wish to add a convar for image duration and a gui element to adjust how long they are displayed. Possibly a convar to enable or disable image support.