Monday, November 08, 2010 at 12:00 AM.

river2Suite.loadImage

on loadImage (fname, pta=nil) {
	<<Changes
		<<5/4/10; 6:08:13 AM by DW
			<<For JavaScript includes we need to have hard-coded URLs to the images, because we have no ability to put image files in the same folder as the page being displayed. 
		<<6/20/09; 5:50:49 AM by DW
			<<Created. 
	local (adrgif = @river2Website.["#images"].[string.nthfield (fname, ".", 1)], imgUrl);
	adrgif^ = binary (river2Suite.loadFromFolder (fname));
	setBinaryType (adrgif, "GIFf");
	local (hw = html.getgifheightwidth (adrgif));
	bundle { //set imgUrl, 5/4/10 by DW
		if defined (pta^.river2.urlImageFolder) {
			imgUrl = pta^.river2.urlImageFolder + fname}
		else {
			imgUrl = "images/" + fname}};
	local (img = "<img src=\"" + imgUrl + "\" height=\"" + hw [1] + "\" width=\"" + hw [2] + "\" border=\"0\" />");
	if pta != nil {
		local (adrtable = @pta^.river2images);
		if not defined (adrtable^) {
			new (tabletype, adrtable)};
		adrtable^.[fname] = adrgif};
	return (img)};
bundle { //test code
	dialog.alert (loadImage ("xml.gif", @scratchpad.viewNewsParams))}



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.