473,803 Members | 3,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing code form using response.output stream

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.output stream.

While this is a budget solution it suited the purpose at the time. I now
want to reuse this code but because using response.output stream 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
Nov 18 '05 #1
2 1881
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_i mage.aspx"

The browser automatically detects the image type and renders it accordingly

Joe Agster
Nov 18 '05 #2
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.
"1" <1@2.3> wrote in message news:On******** ******@TK2MSFTN GP10.phx.gbl...
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.output stream.

While this is a budget solution it suited the purpose at the time. I now
want to reuse this code but because using response.output stream 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

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1397
by: Gav | last post by:
Hi all, I'm trying to create a bitmap and then use outputstream to display the picture: objBitmap.Save(Response.OutputStream, ImageFormat.Jpeg); It doesn't give me any errors although the web page comes up with lots of characters in the page instead of a picture... I then added:
6
3440
by: Bruce W.1 | last post by:
The intent of my web service is an RSS feed from a blog. Originally I used a StringBuilder to make the XML and returned a string from the webmethod. But this doesn't display properly in IE. So now I'm trying an XmlTextWriter instead. I whipped-up another webservice based on this: http://www.codeproject.com/aspnet/RSSviaXmlTextWriter.asp?print=true This example isn't set up strictly as a webservice. It seems to output to an aspx...
3
3222
by: Richard | last post by:
I'm working on a site that creates mailing labels. When a label is generated, two things happen in the background with the image. First, it is saved as a smaller low-quality .gif on the server and then presented as a preview using an img tag (also later used for a history feature on the site). Second, when the user clicks on the image, a new window appears with only the mailing label as a high-quality .png graphic. I don't save the...
0
1089
by: al | last post by:
Greeings All, Your kine help is really appreciated. I have this simple UserControl(ChangeDirection.aspx) with a button on it to trigger change of Browser direction,right to left(rtl)(there is another button that does the opposite), and in the process of changing directions, it displays (using Response.Redirect) another webform(ProcessDirection.aspx) to inform user the direction is being changed. Then It should change directin of the...
1
9132
by: Machi | last post by:
let say i have a web form with a button on it ... when i click the button, it will pop up one small window to allow me to save a pdf file, everything is done using code behind as below ... however, in javascript, i have set a global variable as a flag to indicate the number of times user click the buttion (let say flagNoOfClick), when user clicks the button once, it will set the flag (flagNoOfClick) to "true" (by using javascript). So, when user...
3
2141
by: André | last post by:
Hi, I want to include a graphic made in file2 into file. File must first send a value to file2 (with Response.Redirect) which will be used for the graphic. My problem is that only the graphic is rendered and not the content of file1. Thanks for help. André
3
1953
by: nnaveenraju | last post by:
Hi Gurus, I am new to Ajax and JAVA. I am able to call the servlet class from the JSP page using AJAX. The servlet class is called successfully. I am processing some data and the data has to passed back to the front end JSP. I have used the following code
0
1435
by: Chris Ashley | last post by:
I'm writing files directly to Response.OutputStream... setting the headers like so: HttpContext.Current.Response.Buffer = false; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "binary/octet- stream"; HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=" + strOutputFilename); long lngSize = GetFileSize(strFTPURL, strFileName);
3
2903
by: kellygreer1 | last post by:
PHP will alllow you to build up an entire page and before sending that out as the response.... you can grab all the text and do search and replaces, add comments, make more CSS/XHTML compliant, etc... I have bee trying to do the same thing in ASP.NET by manipulating the Response.OutputStream. I keep getting the error: Exception Details: System.ArgumentException: Stream was not readable. On this line: StreamReader sr = new...
0
9700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10546
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10292
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7603
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.