Well figured it out completely so here's the code for people wondering:
public static string getThatThumbnail(int fileID, int width, int height, int maxwidth) //I had trouble getting custom functions to work (following the Dev guides), so I had to make the function static... could be my version of .net
{
MediaFileInfo myFile = MediaFileInfoProvider.GetMediaFileInfo(fileID);
string siteName = CustomSiteInfoProvider.GetSiteInfo(myFile.FileSiteID).SiteName;
MediaLibraryInfo myLibrary = MediaLibraryInfoProvider.GetMediaLibraryInfo(myFile.FileLibraryID);
string websitePath="C:\\yoursiteslocalpath\\KenticoCMS"
string thumbnailfilename = myFile.FileName + "_" + myFile.FileExtension.Replace(".", "") + "_preview" + myFile.FileExtension;
string localFilePath = MediaFileInfoProvider.GetThumbnailPath(myFile.FileLibraryID, myFile.FilePath) + "\\" + thumbnailfilename;
string returnValue = MediaFileInfoProvider.GetThumbnailPath(myFile.FileLibraryID, myFile.FilePath).Replace(websitePath, "").Replace("\\", "/") + "/" + myFile.FileName + "_" + myFile.FileExtension.Replace(".","") + "_preview" + myFile.FileExtension; // Note that I'm converting this from a local system path to a web address of the form /MediaGallery/Images/__thumbs/randomfile_jpg_preview.jpg which we can plug into an <img> tag
if (!System.IO.File.Exists(localFilePath)) //if the thumb doesn't exist, we make one
{
byte[] myThumb = MediaFileInfoProvider.GetImageThumbnail(MediaFileInfoProvider.GetMediaFileInfo(fileID), myLibrary.LibraryFolder, siteName, width, height, maxwidth);
System.IO.File.WriteAllBytes(localFilePath, myThumb); //Note that this doesn't check whether or not thumbnails generated by other parts of the CMS exist, nor does it check if the thumbnail that exists is of your desired size.
}
return returnValue; // send the output to the transformation file that called it
}
}
Note that I added this declaration to the top:
using CMS.MediaLibrary;
in the Transformation file:
<%# CMSTransformation.getThatThumbnail((int)Eval("FileID"), 0, 0, 200) %>
For some reason, the only way I could get custom transformations to work was to specify the CMSTransformation class name, and because of that, I had to make the function static.