文本如何转换为图片?
从数据库中读出的一段文本,如何转换为jpg图片显示呢?求代码
------解决方案--------------------
那个不是文本是二进制流,你得有读取二进制流的页面;
public DataRow GetBookDetail(int BookId)
		{
			string strsql;
			DataSet myDs;
			try
			{
				strsql="select BookType.Name as BookTypeName,book.id,book.name,author,price,type,publisher,Description,translator,discount,hits,status,sales,image=case when(not Cover is null) then ' <img src=ReadBookCover.aspx?id='+cast(book.id as varchar(10))+' Border=1 width=80 height=120>' else ' <img src=img/pic.jpg border=1 width=80 height=120>' end from book join BookType on book.type=booktype.id where Book.id="+BookId;
				myDs=ExecuteSql4Ds(strsql);
				return myDs.Tables[0].Rows[0];
			}
			catch(
System.Data.SqlClient.SqlException er)
			{
				throw new Exception(er.Message);
			}
		}
读取二进制流的页面代码:
DataView myDv;
int id=int.Parse(Request.QueryString["id"].Trim());
       SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=bookshop;Integrated Security=True");       
       string cmdText = "select cover from book where id="+id+"";
       con.Open();
       SqlDataAdapter sda = new SqlDataAdapter(cmdText,con);
       DataSet ds = new DataSet("ds");
       sda.Fill(ds);
       myDv = ds.Tables[0].DefaultView;
       con.Close();            
       try
       {
           Response.ContentType = "image/*";
           Response.BinaryWrite((byte[])myDv[0]["Cover"]);
       }
       catch
       {
           Response.Write("/img/pic.jpg");
       }