当前位置: 代码迷 >> ASP.NET >> ,顶者有分. asp 请求 c# dll 有关问题
  详细解决方案

,顶者有分. asp 请求 c# dll 有关问题

热度:5351   发布时间:2013-02-25 00:00:00.0
高手请进,顶者有分. asp 请求 c# dll 问题
dll   类代码

                ///   缩略图
                  public   static   byte[]   GetThumbnail(byte[]   img,   int   width,   int   height,   string   mode)
                {
                        System.IO.MemoryStream   ms   =   new   System.IO.MemoryStream(img);
                        Image   originalImage   =   System.Drawing.Image.FromStream(ms);

                        int   towidth   =   width;
                        int   toheight   =   height;

                        int   x   =   0;
                        int   y   =   0;
                        int   ow   =   originalImage.Width;
                        int   oh   =   originalImage.Height;
                        Image   bitmap;
                        if   (ow   >   towidth   ||   oh   >   toheight)
                        {
                                switch   (mode)
                                {
                                        case   "HW "://指定高宽缩放(可能变形)                                
                                                break;
                                        case   "W "://指定宽,高按比例                                        
                                                toheight   =   originalImage.Height   *   width   /   originalImage.Width;
                                                break;
                                        case   "H "://指定高,宽按比例
                                                towidth   =   originalImage.Width   *   height   /   originalImage.Height;
  相关解决方案