Tuesday, August 18, 2009 at 7:31 PM.

newsRiverSuite.imageRef

on imageRef (path, usemap="", align="", hspace="", vspace="", alt="") {
	<<Changes
		<<8/17/08; 9:25:52 AM by DW
			<<Reference an image in the #images table of newsRiverWebsite. A replacement for the verb in dotOpmlSuite.
	local (heightWidth);
	if path beginswith "newsRiver/" {
		path = string.delete (path, 1, 10)};
	bundle { //set heightWidth
		local (adrcache = @system.temp.newsRiver.hwCache);
		if not defined (adrcache^) {
			new (tabletype, adrcache)};
		adrcache = @adrcache^.[path];
		if defined (adrcache^) {
			heightwidth = adrcache^}
		else {
			local (nomad = @newsRiverWebsite.["#images"]);
			local (ctfields = string.countfields (path, "/"), i, hwlist);
			for i = 1 to ctfields {
				nomad = @nomad^.[string.nthfield (path, "/", i)]};
			case getbinarytype (nomad^) {
				'GIFf';
				'gif ' {
					hwlist = html.getGifHeightWidth (nomad)};
				'JPEG' {
					hwlist = html.getJpegHeightWidth (nomad)}};
			heightwidth = "height=\"" + hwlist [1] + "\" width=\"" + hwlist [2] + "\"";
			adrcache^ = heightwidth}};
	path = "images/" + path;
	return ("<img src=\"" + path + "\" border=\"0\" " + heightwidth + usemap + align + hspace + vspace + alt + " />")}
<<bundle //test code
	<<webbrowser.displaytext (imageRef ("newsRiver/icons/xml"))



This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.