UpdatePanel Image -Update
-
Hi, after to may places, I came here to clear my wavering mind..because this is the place which helped me in many areas... My requirement is to update the updatepanel image after doing the round corner image works... Also without roundcorner image functions, it's working fine...But Iam looking to update the updatepanel after doing the roundcorner image functions.. My Codes..
protected void Timer1_Tick(object sender, EventArgs e)
{
NameValueCollection MyImgList = new NameValueCollection();
MyImgList.Add("Img1", "~/MyImages/Picture1.jpg");
MyImgList.Add("Img2", "~/MyImages/Picture2.jpg");
MyImgList.Add("Img3", "~/MyImages/Picture3.jpg");
Random Rnd = new Random();
int Indx = Rnd.Next(0, 4);
//Image1.ImageUrl = MyImgList[Indx].ToString();
// ********** Until here working fine...***************//Round Corner Image works... string path = Server.MapPath(MyImgList\[Indx\].ToString()); int roundedDia = 50; using (System.Drawing.Image imgin = System.Drawing.Image.FromFile(path)) { System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(imgin.Width, imgin.Height); Graphics g = Graphics.FromImage(bitmap); g.Clear(Color.White); Brush brush = new System.Drawing.TextureBrush(imgin); FillRoundedRectangle(g, new Rectangle(0, 0, imgin.Width, imgin.Height), roundedDia, brush); // done with drawing dispose graphics object. g.Dispose(); // Stream Image to client. Response.Clear(); Response.ContentType = "image/pjpeg"; bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); Response.End(); // dispose bitmap object. bitmap.Dispose(); } Image1.ImageUrl = ?????? how to mention here ? Because the confusion is image get disposed ???? }
Thanks for the guidances:thumbsup:
-
Hi, after to may places, I came here to clear my wavering mind..because this is the place which helped me in many areas... My requirement is to update the updatepanel image after doing the round corner image works... Also without roundcorner image functions, it's working fine...But Iam looking to update the updatepanel after doing the roundcorner image functions.. My Codes..
protected void Timer1_Tick(object sender, EventArgs e)
{
NameValueCollection MyImgList = new NameValueCollection();
MyImgList.Add("Img1", "~/MyImages/Picture1.jpg");
MyImgList.Add("Img2", "~/MyImages/Picture2.jpg");
MyImgList.Add("Img3", "~/MyImages/Picture3.jpg");
Random Rnd = new Random();
int Indx = Rnd.Next(0, 4);
//Image1.ImageUrl = MyImgList[Indx].ToString();
// ********** Until here working fine...***************//Round Corner Image works... string path = Server.MapPath(MyImgList\[Indx\].ToString()); int roundedDia = 50; using (System.Drawing.Image imgin = System.Drawing.Image.FromFile(path)) { System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(imgin.Width, imgin.Height); Graphics g = Graphics.FromImage(bitmap); g.Clear(Color.White); Brush brush = new System.Drawing.TextureBrush(imgin); FillRoundedRectangle(g, new Rectangle(0, 0, imgin.Width, imgin.Height), roundedDia, brush); // done with drawing dispose graphics object. g.Dispose(); // Stream Image to client. Response.Clear(); Response.ContentType = "image/pjpeg"; bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); Response.End(); // dispose bitmap object. bitmap.Dispose(); } Image1.ImageUrl = ?????? how to mention here ? Because the confusion is image get disposed ???? }
Thanks for the guidances:thumbsup:
You have to write the image to the disk drive, and then call the URL path for it. In the old days, when I was using PHP, we wrote the image to memory, and used webpage to hold the memory stream, and then called the webpage URL to substitute as the image file. But if yo wrote a multi user system, then everyone may get the same image, if used at the same time, so now you have to do some work with unique image names. Why not just make the round corners a head time at just use them? I think you can make a round corner canvas, and place your image over the canvas, and save the combined images.