TADS 3.1 - image not visible with WebUI

I’ve been working on a web-playable version of It, and I pretty much have everything compatible with WebUI now. There’s just one problem left, and I’m finding it a doozy. I can’t get the WebUI version of the game to display images.

For testing purposes, I’ve dropped this code into gameMain.showIntro():

"""<.p><img src="cover art/cover.jpg"><.p>""";

It works just fine in the original UI version of the game, but when I run the WebUI version, all I get is a broken image link icon (you know, that irritating red-cross-in-a-box thing). The .t3 and .t3m files for both versions are all in the same folder, so they shouldn’t have any trouble finding the cover art, and I added the file to the Resources section of the project file. I tried placing the cover art file in the same folder as the .t3m and .t3 files, rather than a subfolder. I tried messing with the format of the tag. I tried compiling the game for release. I tried running the game (both the debug version and the release version) in the stand-alone HTML TADS for Windows interpreter, rather than through Workbench. I created a new WebUI project from scratch and tried getting an image to display in that. I even uninstalled and reinstalled the TADS Author’s Kit and Player’s Kit. No dice.

I’m completely baffled. Anyone have any ideas?

WebUI games won’t serve up resources from anywhere but webuires by default, for various security-flavored reasons.

You’ll need to add something like this to one of your source files:

WebResourceResFile
	vpath = static new RexPattern('/cover<Space>art/')
;

(Untested; the syntax may be a bit fiddly with the space in the directory name.)

Works perfectly, thank you!

I’m just wondering - where in the documentation would I have had to look to find that out? Even now I know what I’m looking for, I can’t find any mention of it. I was wondering if I’d just skimmed through the System Manual article on WebUI too quickly and missed it, but I’m still not seeing an explanation there.

I discovered the WebResourceResFile class when reading through the webui.t source code. I’m not aware that it’s documented, outside of the Library Reference Manual.

It is in the system manual.