Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Response.

    My application generates images dynamic. These images are
    then used for an image button like in the beneath.

    Dim ob As Bitmap = New Bitmap(130, 30)
    Dim banner As Graphics = Graphics.FromImage(ob)

    Dim tempfilepath As String = System.IO.Path.GetTempPath
    ob.Save(tempfilepath & "temp.jpg",
    Imaging.ImageFormat.Jpeg)

    image_button.ImageUrl = tempfilepath & CType(i, String) &
    "temp.jpg"

    Is it also possible to add this graphic with the help of
    Response.BinaryWrite etc.? If yes how must the code luck like?

    Thanks for all help

    Jenny
    Jenny Guest

  2. Similar Questions and Discussions

    1. Slow login response response on TS 03 in AD mixed mode
      We upgraded our NT 4 domain to an AD mixed until we get rid of the NT 4 BDC;s after completing this upgrade users began complaining about how long...
    2. Response.Flush / Response.Redirect
      Hi, I've had a good google and can't find anything already on this so : I'm currently trying to have a 'Page Loading' page on a site. The way...
    3. AW7 vs. DirectorMX for psychology experiment using response times AND response answers
      Hello, I'm very new to application design, but need to develop a web based application to use at multiple schools as part of an experimental...
    4. Response.Write and Response.Redirect
      On my Page_Load event, i need to do some validation and then either let them proceed, or display a error message and boot them back to the previous...
  3. #2

    Default Re: Response.

    I'm thinking that you want to stream the image down as opposed to saving it
    to disk. What you can do is create a separate page that just streams down
    the bytes for an image. Create a new .aspx page and remove all the HTML
    content. Add this code to the page_load event:

    Bitmap ob = new Bitmap(130, 30);
    Graphics banner = Graphics.FromImage(ob);
    ob.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

    Next, in the page with your ImageButton control, set the source of the
    ImageButton to the page you created above. For example, if your page was
    called webform2.aspx, you'd have:

    ImageButton1.ImageUrl = "webform2.aspx";

    You can customize with parameters or whatever you need in order to generate
    an appropriate image for that particular user.

    --
    James J. Foster, DotNetCoders
    [url]http://www.dotnetcoders.com[/url]


    "Jenny" <j.malloyNO@SPAMx-mail.net> wrote in message
    news:0a2901c35753$5275a690$a501280a@phx.gbl...
    > My application generates images dynamic. These images are
    > then used for an image button like in the beneath.
    >
    > Dim ob As Bitmap = New Bitmap(130, 30)
    > Dim banner As Graphics = Graphics.FromImage(ob)
    >
    > Dim tempfilepath As String = System.IO.Path.GetTempPath
    > ob.Save(tempfilepath & "temp.jpg",
    > Imaging.ImageFormat.Jpeg)
    >
    > image_button.ImageUrl = tempfilepath & CType(i, String) &
    > "temp.jpg"
    >
    > Is it also possible to add this graphic with the help of
    > Response.BinaryWrite etc.? If yes how must the code luck like?
    >
    > Thanks for all help
    >
    > Jenny

    James J. Foster Guest

  4. #3

    Default Re: Response.

    Hi Karl,

    thanks for the suggestion. But there is an image before the
    sentence 'and place that in your' which I can't see. Can
    you send it a second time?

    Thanks
    Jenny

    >-----Original Message-----
    >Haven't dealt with GDI+ in a bit..but instead of saving
    the file to the
    >filesystem which you are doing via:
    >ob.Save(tempfilepath & "temp.jpg", Imaging.ImageFormat.Jpeg)
    >
    >why not save it to the response's outputstream ala:
    >
    >ob.save(Response.OutputStream, Imaging.ImageFormat.Jpeg)
    >
    >if you look at the save method, you'll see that you can
    save both to a file
    >and to a stream...which is exactly why there's a a
    Response.OutputStream :)
    >
    >However, you'll have to change your logic a bit. If you
    save the bitmap to
    >the outputstream, you won't be able to render any text or
    anything...that's
    >because you can't have a mix of binary and text contenxt
    outputted to the
    >screen (just the way HTTP works...not an asp.net
    limitation). SO what you'd
    >need to do is something like this:
    >
    ><img src="mytempimage.aspx" width="130" height="30"> and
    place that in your
    >aspx page. This'll work because each image is fetched by
    the browser in
    >its own stream/request. Then in mytmepimage.aspx you can
    simply save the
    >image to the response.outputstream...you'll also want to
    set your
    >response.contenttype accordingly..something like "umage/jpeg"
    >
    >Karl
    >
    >
    >
    >"Jenny" <j.malloyNO@SPAMx-mail.net> wrote in message
    >news:0a2901c35753$5275a690$a501280a@phx.gbl...
    >> My application generates images dynamic. These images are
    >> then used for an image button like in the beneath.
    >>
    >> Dim ob As Bitmap = New Bitmap(130, 30)
    >> Dim banner As Graphics = Graphics.FromImage(ob)
    >>
    >> Dim tempfilepath As String = System.IO.Path.GetTempPath
    >> ob.Save(tempfilepath & "temp.jpg",
    >> Imaging.ImageFormat.Jpeg)
    >>
    >> image_button.ImageUrl = tempfilepath & CType(i, String) &
    >> "temp.jpg"
    >>
    >> Is it also possible to add this graphic with the help of
    >> Response.BinaryWrite etc.? If yes how must the code luck
    like?
    >>
    >> Thanks for all help
    >>
    >> Jenny
    >
    >
    >.
    >
    Jenny Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139