hi i have got 150mb image size , when i start my web application then have to wait long time.... thats why , i did split into small part when user drag left hand side two small part join together current display image and left hand side..... similar way right hand side top ...., bottom like a google map when you drag image mege it and cache it help me
<%@ WebHandler Language="C#" Class="ReadImage" %> using System; using System.Web; using System.Data.SqlClient; using System.IO; using System.Configuration; using System.Collections.Generic; using System.Data; public class ReadImage : IHttpHandler { public void ProcessRequest (HttpContext context) { Int32 e_id = 1; if (context.Request.QueryString["id"] != null) { e_id = Convert.ToInt32(context.Request.QueryString["id"]); } else throw new ArgumentException("No parameter specified"); context.Response.ContentType = "image/jpeg"; Stream strm = DisplayImage(e_id); byte[] buffer = new byte[strm.Length]; int byteSeq = strm.Read(buffer, 0,(int) strm.Length); while (byteSeq > 0) { context.Response.OutputStream.Write(buffer, 0, byteSeq); byteSeq = strm.Read(buffer, 0, (int)strm.Length); } } public Stream DisplayImage(int ID) { string cs = ConfigurationManager.ConnectionStrings["LocationTrackingConnectionString"].ConnectionString; using (SqlConnection connection = new SqlConnection(cs)) { string sql = "SELECT image FROM tblImage WHERE id between @ID1 and @ID2 "; using (SqlCommand cmd = new SqlCommand(sql, connection)) { cmd.CommandType = System.Data.CommandType.Text; cmd.Parameters.Add("@ID1",System.Data.SqlDbType.Int).Value=ID; cmd.Parameters.Add("@ID2", System.Data.SqlDbType.Int).Value = 20; connection.Open(); SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); //SqlDataReader theImg = cmd.ExecuteReader(); object img1 = ds.Tables[0].Rows[0].ItemArray[0]; object img2 = ds.Tables[0].Rows[1].ItemArray[0]; try { return new MemoryStream((byte[])img1); } catch { return null; } finally { cmd.Dispose(); connection.Close(); connection.Dispose(); } } } } public bool IsReusable { get { return false; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)