Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. UpdatePanel Image -Update

UpdatePanel Image -Update

Scheduled Pinned Locked Moved ASP.NET
graphicssysadmintutorialquestionannouncement
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paramu1973
    wrote on last edited by
    #1

    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:

    J 1 Reply Last reply
    0
    • P Paramu1973

      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:

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups