// Then request for absolute path "/appname/img/faces/happy.gif" will serve
// "/tmp/myimg/faces/happy.gif", just as the the request for relative path "img/faces/happy.gif".
Remember the browser is interpreting the image location, and it needs to point to an http endpoint to get the image. The endpoint is your gowut app serving the image.
Glen
But, may be anyone had the working code sample? I use AddStaticDir func this (wrong) way:
server := gwu.NewServer("UPS", str_localhost_port)
server.SetText("* ИБП Титан *")
server.AddStaticDir("pic", "/home/adm/go/src/adm/gups/pict")
img := gwu.NewImage("PSDlogo", "pic/logo.gif") // not works//img := gwu.NewImage("PSDlogo", "/UPS/pic/logo.gif") // doesn't work//img := gwu.NewImage("PSDlogo", "192.168.0.20/UPS/pic/logo.gif") // doesn't work too//img := gwu.NewImage("PSDlogo", "http://localhost/UPS/pic/logo.gif") // doesn't work also
img.Style().SetSizePx(275, 95)
win.Add(img)
logo.gif is inside /home/adm/go/src/adm/gups/pict ,
but browser does not render this image .
среда, 29 марта 2017 г., 15:49:29 UTC+3 пользователь Tony Falcone написал:
server := gwu.NewServer("UPS", str_localhost_port)
server.AddStaticDir("pic", "/home/adm/go/src/adm/gups/pict")
// Create and build a window
win := gwu.NewWindow("main", "UPS info")
win.Style().SetFullWidth()
win.SetHAlign(gwu.HACenter)
win.SetCellPadding(2)
img := gwu.NewImage("PSDlogo", "pic/logo.png")
img.Style().SetSizePx(275, 95)
win.Add(img)
//......
server.AddWin(win)
server.Start("main")