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. Show Image on webpage

Show Image on webpage

Scheduled Pinned Locked Moved ASP.NET
5 Posts 3 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.
  • D Offline
    D Offline
    Deresen
    wrote on last edited by
    #1

    Hey all, In my backend (code), i've got a Bitmap, which I've filled with some pixels. Now I want to show this image on an aspx page. Does anyone has any idea how to solve this problem. I've tried , but this needs an url. I Also tried but this also needs an url.

    A Y 2 Replies Last reply
    0
    • D Deresen

      Hey all, In my backend (code), i've got a Bitmap, which I've filled with some pixels. Now I want to show this image on an aspx page. Does anyone has any idea how to solve this problem. I've tried , but this needs an url. I Also tried but this also needs an url.

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Img tags are the only way to show images over an HTML. Img requires an url directly to the image. so you have to store the bitmap to your virtual dir and then get the image. There is no other way of doing this. :rose::rose:

      Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
      Create .NET Templates

      D 1 Reply Last reply
      0
      • D Deresen

        Hey all, In my backend (code), i've got a Bitmap, which I've filled with some pixels. Now I want to show this image on an aspx page. Does anyone has any idea how to solve this problem. I've tried , but this needs an url. I Also tried but this also needs an url.

        Y Offline
        Y Offline
        Yusuf
        wrote on last edited by
        #3

        Save the Image then you can create tag from the code.

        Yusuf Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]

        1 Reply Last reply
        0
        • A Abhishek Sur

          Img tags are the only way to show images over an HTML. Img requires an url directly to the image. so you have to store the bitmap to your virtual dir and then get the image. There is no other way of doing this. :rose::rose:

          Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
          Create .NET Templates

          D Offline
          D Offline
          Deresen
          wrote on last edited by
          #4

          Thank you for your response. Though the anwser has been given to me by my colegue. It's like this: backend page 1:

          Image1.ImageUrl = "GetImage.aspx?id="

          backend page 'getImage.aspx':

          int number = int.Parse(Page.Request.QueryString.Get("id"));

          Bitmap b = makeImageByNumber(number);

                  //Set the Responsetype
                  Response.ContentType = "image/jpeg";
                  //Save the dynamicly generated bitmap to the OutpuStream
                  b.Save(Response.OutputStream, ImageFormat.Jpeg);
          
                  //End we're done.
                  Response.End();
          
          A 1 Reply Last reply
          0
          • D Deresen

            Thank you for your response. Though the anwser has been given to me by my colegue. It's like this: backend page 1:

            Image1.ImageUrl = "GetImage.aspx?id="

            backend page 'getImage.aspx':

            int number = int.Parse(Page.Request.QueryString.Get("id"));

            Bitmap b = makeImageByNumber(number);

                    //Set the Responsetype
                    Response.ContentType = "image/jpeg";
                    //Save the dynamicly generated bitmap to the OutpuStream
                    b.Save(Response.OutputStream, ImageFormat.Jpeg);
            
                    //End we're done.
                    Response.End();
            
            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            That means you are directly writing the image stream to the response. it is same as making writing a static link. If you want to do this, why not u use a special handler for the response. Like ImageResource.axd which corresponds to an handler which will produce images. Even Microsoft does take this steps for writing javascript files to the client. :rose:

            Abhishek Sur My Latest Articles Basics on LINQ and Lambda Expressions
            Create .NET Templates

            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