.net的高手们帮帮拉!不胜感激。..

解决方案 »

  1.   

    Stream stream=File1.PostedFile.InputStream;
    if (stream!=null)
    {
    Bitmap bitmap=new System.Drawing.Bitmap(stream);
    System.Drawing.Image image=bitmap.GetThumbnailImage(10,10,null,null);
    image.Save("c://image//aa.gif",System.Drawing.Imaging.ImageFormat.Gif);
    }
      

  2.   

    敢问blackcatiii(ljh):用asp行么?
      

  3.   

    no.
    asp的话就得要自己写组件了。
      

  4.   

    2002软件报上已刊过(asp.net),C#提供了缩略方法。
      

  5.   

    欧?可有组件共享?(to  blackcatiii(ljh) );
    give me "2002软件报上已刊过(asp.net),C#提供了缩略方法。"
    my email:[email protected]
      

  6.   

    sample:
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.IO;namespace DayOfDeveloper
    {
        public class ThumbnailGenerator : System.Web.UI.Page
        {
            private void Page_Load(object sender, System.EventArgs e)
            {
                String _path = Server.MapPath("images/");
                if ( !_path.EndsWith(@"\") )
                    _path += @"\";            DirectoryInfo _di = new DirectoryInfo(_path);
                FileInfo[] _fi = _di.GetFiles("*.jpg");            foreach ( FileInfo _f in  _fi)
                {
                    if ( !_f.Name.StartsWith("thumb_") )
                    {
                        String _imgName = _f.Name;
                
                        System.Drawing.Image _img = System.Drawing.Image.FromFile(_path + _imgName);                    if ( _img.Height > 72 )
                        {
                            Int32 _height = _img.Height;
                            Int32 _width = _img.Width;
                
                            Bitmap _imgOutput;
                            Double _dif;                        _dif = Convert.ToDouble(Decimal.Divide(_width,_height));
                            _width = Convert.ToInt32(Math.Ceiling(72 * _dif));
                            _imgOutput = new Bitmap(_img, _width, 72);
                            _img.Dispose();                        try
                            {
                                _imgOutput.Save(_path + "thumb_" + _imgName.ToLower(), System.Drawing.Imaging.ImageFormat.Jpeg);
                                _imgOutput.Dispose();
                                Response.Write("thumb_" + _imgName.ToLower() + " Saved</b><br>");
                            }
                            catch ( Exception _ex )
                            {
                                Response.Write("<b>Error Saving File</b><br>");
                                Response.Write(_ex.Message);
                                Response.Write("<br>");
                                Response.Write(_ex.StackTrace);
                                Response.Write("<br>");
                            }
                        }
                    }
                }
            }        #region Web Form Designer generated code
            override protected void OnInit(EventArgs e)
            {
                //
                // CODEGEN: This call is required by the ASP.NET Web Form Designer.
                //
                InitializeComponent();
                base.OnInit(e);
            }
            
            /// <summary>
            /// Required method for Designer support - do not modify
            /// the contents of this method with the code editor.
            /// </summary>
            private void InitializeComponent()
            {    
                this.Load += new System.EventHandler(this.Page_Load);
            }
            #endregion
        }
    }
      

  7.   

    Image类里有一个GetThumbnailImage方法
      

  8.   

    像这样?
    http://www.aspsky.net/article/list.asp?id=2576
    http://www.aspsky.net/article/list.asp?id=2575
    http://www.aspsky.net/article/list.asp?id=2573
    http://www.aspsky.net/article/list.asp?id=2574
    可以?