Image Problems

Discussion in 'ASP .Net' started by BluDog, May 25, 2004.

  1. BluDog

    BluDog Guest

    Hi

    I have a class that has a System.Drawing.Image as a property, i would
    like to display this image on my WebForm, however i think i need to
    get it into a System.Web.UI.WebControls.Image object, but i cannot
    work out how do conver it.

    Any ideas?

    Thanks

    blu
    BluDog, May 25, 2004
    #1
    1. Advertising

  2. No, you don't want to get it into a System.Web.UI.webControls.Image object.
    All that does is render HTML for an image in the page. It doesn't create an
    image and stream it to the client. What you need to do is to create an ASPX
    page that will serve as the image itself. This is done by setting the
    Response.ContentType to "image/jpg" (or whatever image type), and streaming
    the image back to the browser.

    Images in an HTML document are links/references to the URLs for the image
    resources that they link to. When the browser encounters an <img
    src="someurl"> tag, it creates an HTTP Request for that resource, which it
    receives, and then lays out in the page. So, an HTML document is not
    necessarily a single Request from the browser, but as many Requests as there
    are separate resources in the document.

    In the ASPX page which renders the image, you would put a regular image tag
    in, with the URL pointing to the ASPX page that delivers the image. Example:

    <img src="Images.aspx">

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    Big things are made up
    of lots of little things.

    "BluDog" <> wrote in message
    news:...
    > Hi
    >
    > I have a class that has a System.Drawing.Image as a property, i would
    > like to display this image on my WebForm, however i think i need to
    > get it into a System.Web.UI.WebControls.Image object, but i cannot
    > work out how do conver it.
    >
    > Any ideas?
    >
    > Thanks
    >
    > blu
    Kevin Spencer, May 25, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry J
    Replies:
    0
    Views:
    542
    Jerry J
    Jul 18, 2003
  2. Mike John
    Replies:
    0
    Views:
    503
    Mike John
    Jul 28, 2003
  3. Gary B

    Image can't hold an image?

    Gary B, Jul 31, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    341
    Steve C. Orr, MCSD
    Aug 1, 2003
  4. Jim Hammond
    Replies:
    1
    Views:
    484
    Oliver
    Nov 13, 2003
  5. Laszlo Zsolt Nagy
    Replies:
    1
    Views:
    1,263
    Kartic
    Jan 26, 2005
Loading...

Share This Page