62,254
社区成员
发帖
与我相关
我的任务
分享
System.Drawing.Image myImage = System.Drawing.Image.FromFile(Request.PhysicalApplicationPath+Label4.Text);
//src是原来的图片的路径
int iWidth,iHeight;
iWidth=246;
iHeight=185;
//
System.Drawing.Image aNewImage = myImage.GetThumbnailImage(iWidth, iHeight, null, new System.IntPtr());
//iWidth,iHeight是你想要得新的图片的宽度和高度
string strNewName2 =DateTime.Now.ToString("MMddhh").ToString() + upFile.PostedFile.ContentLength.ToString() + strExt;
aNewImage.Save(Request.PhysicalApplicationPath+"hdp/"+strNewName2);
//新的图片的文件名
Label3.Text="hdp/"+strNewName2;
myImage.Dispose();