string filename=Request.QueryString["filename"];
Bitmap bmpOld= new Bitmap(Server.MapPath("images/" + filename)); //计算缩小比例
double d1;
if (bmpOld.Height>bmpOld.Width)
d1=(double)(MaxLength/(double)bmpOld.Width);
else
d1=(double)(MaxLength/(double)bmpOld.Height); //产生缩图
Bitmap bmpThumb= new Bitmap(bmpOld,(int)(bmpOld.Width*d1),(int)(bmpOld.Height*d1)); // 清除缓冲
Response.Clear();
//生成图片
bmpThumb.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.End();
//释放资源
bmpThumb.Dispose();
bmpOld.Dispose();
Bitmap bmpOld= new Bitmap(Server.MapPath("images/" + filename)); //计算缩小比例
double d1;
if (bmpOld.Height>bmpOld.Width)
d1=(double)(MaxLength/(double)bmpOld.Width);
else
d1=(double)(MaxLength/(double)bmpOld.Height); //产生缩图
Bitmap bmpThumb= new Bitmap(bmpOld,(int)(bmpOld.Width*d1),(int)(bmpOld.Height*d1)); // 清除缓冲
Response.Clear();
//生成图片
bmpThumb.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.End();
//释放资源
bmpThumb.Dispose();
bmpOld.Dispose();
解决方案 »
- 关于.net下载FTP的问题
- JS拆分字符串
- GridView中的pagesize
- 关于邮件的问题(急!!!!!)
- DataGrid中绑定数据库后,控制列宽的问题
- 求助!!!郁闷的DropDownList问题
- asp.net开发wap网,连接控件之间怎么空格?
- 用Page.ClientScript.RegisterStartupScript調用函數后,再刷新頁面會再次調用。怎樣只調用一次呢?
- 高手帮助:其他系统html页通过window.open打开本页,本页top.opener.window.location.reload刷新父而,报错,报没有权限!
- 控件丢了去哪找??
- 数据采集的问题?(急)
- 怎么可以得到一个时间和现在的时间差呢?
Bitmap bmp= new Bitmap(this.Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["UserUploadFile"]+dr["UserPicture"].ToString());
this.ShowImage.Width=bmp.Height;
this.ShowImage.Height=bmp.Width;
if(System.Int32.Parse(this.ShowImage.Width.Value.ToString())>450)
{
this.ShowImage.Width=450;
this.ShowImage.Height=(System.Int32.Parse(this.ShowImage.Height.Value.ToString())/System.Int32.Parse(this.ShowImage.Width.Value.ToString()))*450;
}