System.IO.FileStream newFile= new System.IO.FileStream(_SavePath + sFilename, System.IO.FileMode.Create);
newFile.Write(myData,0, myData.Length);
newFile.Close();
this.m_BigImgName=sFilename; if(!flag)
{
m_Err=1;
return;
}
string SmallImgPath=_SavePath+"small\\";
if(!System.IO.Directory.Exists(SmallImgPath))
System.IO.Directory.CreateDirectory(SmallImgPath);
System.Drawing.Image.GetThumbnailImageAbort myCallBack =
new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
Bitmap myBitmap;
try
{
myBitmap = new Bitmap(_SavePath+ sFilename);
file_append = 0;
string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(m_UpFile.FileName)
+ sThumbExtension + ".gif";
while (System.IO.File.Exists(SmallImgPath + sThumbFile))
{
file_append++;
sThumbFile = System.IO.Path.GetFileNameWithoutExtension(m_UpFile.FileName) +
file_append.ToString() + sThumbExtension + ".gif";
} // 保存小图片
System.Drawing.Image myThumbnail= myBitmap.GetThumbnailImage(ThumbWidth,
ThumbHeight, myCallBack, IntPtr.Zero);
myThumbnail.Save(SmallImgPath + sThumbFile); this.m_SmallImgName=sThumbFile; myThumbnail.Dispose();
myBitmap.Dispose();
}
catch //(ArgumentException errArgument)
{
m_Err=-3;
System.IO.File.Delete(_SavePath + sFilename);
}
newFile.Write(myData,0, myData.Length);
newFile.Close();
this.m_BigImgName=sFilename; if(!flag)
{
m_Err=1;
return;
}
string SmallImgPath=_SavePath+"small\\";
if(!System.IO.Directory.Exists(SmallImgPath))
System.IO.Directory.CreateDirectory(SmallImgPath);
System.Drawing.Image.GetThumbnailImageAbort myCallBack =
new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback);
Bitmap myBitmap;
try
{
myBitmap = new Bitmap(_SavePath+ sFilename);
file_append = 0;
string sThumbFile = System.IO.Path.GetFileNameWithoutExtension(m_UpFile.FileName)
+ sThumbExtension + ".gif";
while (System.IO.File.Exists(SmallImgPath + sThumbFile))
{
file_append++;
sThumbFile = System.IO.Path.GetFileNameWithoutExtension(m_UpFile.FileName) +
file_append.ToString() + sThumbExtension + ".gif";
} // 保存小图片
System.Drawing.Image myThumbnail= myBitmap.GetThumbnailImage(ThumbWidth,
ThumbHeight, myCallBack, IntPtr.Zero);
myThumbnail.Save(SmallImgPath + sThumbFile); this.m_SmallImgName=sThumbFile; myThumbnail.Dispose();
myBitmap.Dispose();
}
catch //(ArgumentException errArgument)
{
m_Err=-3;
System.IO.File.Delete(_SavePath + sFilename);
}
Bitmap bmp=new Bitmap(img,150,150);
bmp.Save(@"c:\123.jpg")
Bitmap map1=(Bitmap) map.GetThumbnailImage(100,150,null,IntPtr.Zero);
try
{
map1.Save("c:\\0.gif",System.Drawing.Imaging.ImageFormat.Gif);
}
catch(Exception ex)
{
error1.InnerHtml=ex.Message;
}
可不可以的。我不太明白。请给讲一下好吗?
这个问题挺难,你得对GIF文件的格式非常清楚才行!