Hi, I've got a webpart to upload images to a SharePoint image library, and SP does the thumbnail generation automagically.
I'd like to give my users the options of uploading their own thumbnails, without SP doing it for them.
Any thoughts how to do this?
I do know that SP will store the thumbnails in a folder /_t in the library, but I can't seem to write files there programatically... This is what I'm tring to do:
using (SPSite objSite = new SPSite("http://foo.com/"))
{
using (SPWeb objWeb = objSite.OpenWeb())
{
//Need to abstract this library definition...
SPFolder mylibrary = objWeb.Folders["Media/_t"];
// Set AllowUnsafeUpdates = true to avoid security error
objWeb.AllowUnsafeUpdates = true;
mylibrary.Files.Add(System.IO.Path.GetFileName(filename), bytes);
}
}
If I do that I get an error message saying that value does not fall within expected range.
Any ideas?