First of all, this is a excellent product. My only concern is how to save a thumbnail image when uploading image file. I tried creating a simple function and it works fine locally, when deployed on web server, the browser just stops and only the image file uploaded is uploaded to the folder, not the thumbnail.
void SaveImageThumbNail(string ImageFileName, Int32 thumbnailWidth, string loc)
{
System.Drawing.Image objImage;
System.Drawing.Image objThumbnail;
string strServerPath = "";
string strFilename = "";
Int32 shtWidth;
Int32 shtHeight;
strServerPath = loc;
strFilename = ImageFileName;
try
{
if (ImageFileName.Contains("jpg") || ImageFileName.Contains("gif") || ImageFileName.Contains("png") || ImageFileName.Contains("bmp"))
{
objImage = System.Drawing.Image.FromFile(strServerPath + strFilename);
}
else
{
objImage = System.Drawing.Image.FromFile(strServerPath + "noimage.gif");
}
}
catch
{
objImage = System.Drawing.Image.FromFile(strServerPath + "noimage.gif");
}
try
{
shtWidth = thumbnailWidth;
shtHeight = objImage.Height / (objImage.Width / shtWidth);
objThumbnail = objImage.GetThumbnailImage(shtWidth, shtHeight, null, System.IntPtr.Zero);
//Response.ContentType = "image/jpeg";
objThumbnail.Save(strServerPath + "thb_" + ImageFileName);
objImage.Dispose();
objThumbnail.Dispose();
}
catch
{
}
}
and I tried attaching it here
void Uploader_FileUploaded(object sender, UploaderEventArgs args)
{
Uploader uploader = (Uploader)sender;
InsertMsg("File uploaded! " + args.FileName + ", " + args.FileSize + " bytes.");
args.CopyTo(Request.Cookies["fileLoc"].Value.ToString() + args.FileName);
SaveImageThumbNail(args.FileName, 100, Request.Cookies["fileLoc"].Value.ToString());
}
Just want to ask if you have a much simplier solution on how to save thumbnail file for images. Thank You.