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


on newMediaObject (siteUrl, username, password, name, type, bits) {
		<<11/11/09; 11:33:55 AM by DW
	local (adrdata = wordPress.init (), objectdata);
	local (adrsite = wordPress.getSiteData (siteurl), struct, rpcdata);
	wordPress.getRpcData (siteurl, @rpcdata);
	objectdata = metaWeblog.newMediaObject (name, type, bits, username, password, adrsite^.blogid, adrdata:@rpcdata);
	return (objectdata.url)};
bundle { //test code
	local (f = "ohio:pictures:DSCN2944.JPG", fname = file.filefrompath (f));
	local (bits = file.readwholefile (f), type = "image/jpeg");
	webbrowser.openurl (newMediaObject ("", user.wordpress.prefs.username, user.wordpress.prefs.password, fname, type, bits))}

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.