473,831 Members | 2,488 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 1882
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
1400
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
3443
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
3224
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
1090
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
9133
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
1437
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
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10777
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
10494
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...
0
10208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9317
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
7748
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
5620
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.