how to resize image
Posted
by saadan
on Stack Overflow
See other posts from Stack Overflow
or by saadan
Published on 2010-05-19T08:34:19Z
Indexed on
2010/05/19
8:40 UTC
Read the original article
Hit count: 209
I am a little forgetful have made it many times and can not find the code from the last time I made it how do I get it to resize more than one picture
i do like this
Guid imageName;
imageName = Guid.NewGuid();
string storePath = Server.MapPath("~") + "/MultipleUpload";
if (!Directory.Exists(storePath))
Directory.CreateDirectory(storePath);
hif.PostedFile.SaveAs(storePath + "/" + Path.GetFileName(hif.PostedFile.FileName));
string tempPath = "Gallery";
string imgPath = "Galleryt";
string savePath = Path.Combine(Request.PhysicalApplicationPath, tempPath);
string TempImagesPath = Path.Combine(savePath, imageName + hif.PostedFile.FileName);
string imgSavePath = Path.Combine(Request.PhysicalApplicationPath, imgPath);
string ProductImageNormal = Path.Combine(imgSavePath, "t__" + imageName + hif.PostedFile.FileName);
string extension = Path.GetExtension(hif.PostedFile.FileName);
switch (extension.ToLower())
{
case ".png": goto case "Upload";
case ".gif": goto case "Upload";
case ".jpg": goto case "Upload";
case "Upload": hif.PostedFile.SaveAs(TempImagesPath);
ImageTools.GenerateThumbnail(TempImagesPath, ProductImageNormal, 250, 350, true, "heigh");
Label1.Text = "";
break;
}
© Stack Overflow or respective owner