如何将图像从位阵列上传到Web上的图像? [英] How Can I Upload Image From Bit Array To Image On Web Sit ?

查看:68
本文介绍了如何将图像从位阵列上传到Web上的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将图像从位数组上传到网页上的图像?



how can i upload image from bit array to image on web sit ?

sing System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Drawing.Imaging; 
using OnlineTradingSystem;



using System.Text;
using System.Windows;


using System.IO;


using System.Data;
 

namespace WebApplication2
{
    public partial class About : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                List<Product> Prod = new List<Product>();
               
                DAL dalsql = new DAL();
                // ask what the user chouse
                URegistration regis = new URegistration() 
                {Getstorename="carrace" };
                //Ask for the selected number of product 
                Prod= dalsql.ImportSqlData(regis);

                
            

                List<Panel> p = new List<Panel>();
                
                for (int i = 0;Prod.Count > i; i++)
                {
                    p.Add(new Panel()
                    {
                        ID=Convert.ToString(i),
                        ToolTip = "hy",
                        CssClass = "Panel"

                    });

                    Label label = new Label()
                    {
                        Text = Prod[i].ProductName
                    };
                  
                 
                    Image img = new Image()
                    {
                        Height = 171,
                     
                    };
                    MemoryStream ms = new MemoryStream(Prod[i].img, 0, Prod[i].img.Length);
                    ms.Position = 0; // this is important
                  
                  
                    p[i].Controls.Add(img);
                    p[i].Controls.Add(label);

                    Panel2.Controls.Add(p[i]);

                }



}

}

}

}


}
}
}
}

推荐答案

看看这个: ASP.NET的通用Image-From-DB类 [ ^ ] - 这是我使用的代码。
Have a look at this: A generic Image-From-DB class for ASP.NET[^] - it's the code I use.


这篇关于如何将图像从位阵列上传到Web上的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆