using System
using System
private void Button
{
Graphics g=null;
System
System
System
Bitmap outputfile=null;
try
{
string extension = Path
string filename = DateTime
string smallpath = Server
string bigpath = Server
int width
System
if(!Directory
Directory
if(!Directory
Directory
Stream upimgfile = File
string simagefile = Server
simage=System
upimage= System
width = upimage
height = upimage
if(width>height)
{
newwidth=
newheight =(int)((double)height/(double)width * (double)newwidth);
}
else
{
newheight=
newwidth=(int)((double)width/(double)height * (double)newheight);
}
thumimg = upimage
outputfile=new Bitmap(upimage);
g=Graphics
g
string newpath = bigpath + filename + extension; //原始圖路徑
string thumpath = smallpath + filename + extension; //縮略圖路徑
outputfile
thumimg
outputfile
}
catch(Exception ex)
{
throw ex;
}
finally
{
if(g!=null)
g
if(thumimg!=null)
thumimg
if(upimage!=null)
upimage
if(simage!=null)
simage
}
}
public bool ThumbnailCallback()
{
return false;
}
From:http://tw.wingwit.com/Article/program/net/201311/11730.html