I need to set a background image to a webpage.
I’ve found an example here:
While this works this example uses a static URL to the background image.
But using WE I didn’t know how to use a URL to a picture on local disk on my WE server, for example to c:\picture\test1.jpg
To my understanding such a URL must be a non-static=dynamic (webfile URL)
So after some experiments I’ve found that I can do this using a webfile and a pageSource control’s “editSource” event…
Basically what I do is to put the following code in a variable “source_background”
no-repeat center center;min-height:100%;background-size:cover;}
Where “theURL” is a placeholder that will be replaced later.
Then I create a webfile for the image that I want to use in the PageSource EditSource Event:
[code]dim f as folderitem
dim mySource as String
app.mywebfile = webFile.Open(f) 'this will create a URL to the picture: app.mywebfile.url
app.mywebfile.MIMEType = “application/octet-stream”
app.mywebfile.ForceDownload = false
mySource = Replace(source_background,“theURL”,app.mywebfile.url) 'replace placeholder with webfile URL
source = mySource 'set ByRef Variable “source”[/code]
Now my question is if there is another solution?
IE 11 doesn’t show an error - but it doesn’t display the background image… just a blank webpage.
It would be important that it works with current versions of IE.
(Firefox and Chrome both work)