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

system.verbs.builtins.radio.theme.apply.images

on images (adrTheme, folder=user.radio.prefs.wwwFolder) {
	<<Changes
		<<12/31/01; 7:06:35 PM by JES
			<<Fixed a bug where the data written to the image file was incorrect.
		<<12/30/01; 7:28:11 PM by JES
			<<Save the images stored in the Theme table at adrTheme, to the specified folder. Images are saved in the same relative path that they existed in, when the Theme was created.
	
	local (adrImages = @adrTheme^.images);
	
	local (adrimage);
	for adrimage in adrimages {
		local (relpath = nameOf (adrimage^));
		local (f = radio.file.getAbsolutePath (relpath));
		if file.exists (f) { //skip files which already exist, and haven't changed
			if file.size (f) == sizeOf (adrimage^.bits) {
				if file.modified (f) == adrimage^.timeModified {
					if file.created (f) == adrimage^.timeCreated {
						continue}}}};
		local (ext = string.nthField (string.lower (relpath), ".", string.countFields (relpath, ".")));
		local (type);
		case ext {
			"gif" {
				type = 'GIFf'};
			"jpg";
			"jpeg" {
				type = 'JPEG'}};
		file.sureFilePath (f);
		file.writeWholeFile (f, adrimage^.bits, type, user.radio.prefs.imgFileCreator)};
	
	return (true)};

bundle { //testing
	local (adrTheme = @scratchpad.testTheme);
	images (adrTheme)}



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.