Changing code form using response.outputstream

1

1

Hi there,

A while back I wrote some code using the .Net drawing libraries... this code
takes a datatable and generates a pie or bar chart on the fly. The resulting
image is returned using response.outputstream.

While this is a budget solution it suited the purpose at the time. I now
want to reuse this code but because using response.outputstream only allows
the resulting image file to be displayed (by itself with no page around it)
I need to change the way I return the image.

Can anybody suggest how I can return an image generated on the fly to my
page without having to save it to disk first?

I know I can return an image object to the page but how do I then send it to
the browser...? Without saving it to disk that is...

Cheers
 
G

Guest

First, you have to separate the concepts of client and server. The server generates the image, and the client references the drawn image. In the case of the web, you reference an image from the client (browser) the same way you reference a .gif or .jpg file

Each page has a content type, the default being text/html. So, if you have a page called draw_pie_image.aspx that draws the image of any image content type, such as image/gif, then you can reference a page called MainForm.aspx as follows

[MainForm.aspx

<img src="draw_pie_image.aspx"

The browser automatically detects the image type and renders it accordingly

Joe Agster
 
B

bruce barker

while many browsers support inline images, IE is not one of them. you always
have to suppy a seperate url (page) to fetch the image.

Response.Write ("<img scr=myImage.apx?id=" + imageId + ">");

then myImage.apsx renders the image for the given id.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top