473,714 Members | 2,552 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Looped output of images via MemoryStream?

Hi,
I'm trying to write a set of charts (as bitmap objects) out to a memory
stream so
that a variable number of charts can be displayed using just one <img> html
tag
in a holder page. I have everything working except that only one chart is
ever
displayed, no matter how many are actually created. The vb codebehind is
called
by being placed as the source for an img tag in a holder page. The holder
page
also provides a filter for the rendering code in the form of a
dropdownlist -
the selected value of which is passed as a param to the SQL sproc.

Here's the particular section of my code that is outputting the image:

[Note, BEChart is of type BitMap]
<-snipped->
Dim memStream As New System.IO.Memor yStream

Try
' 'Write the chart images held in the array to the output stream
For iLoop = 0 To aryEnts.GetUppe rBound(0)
If Not IsNothing(aryEn ts(iLoop).BECha rt) Then
'Add the current chart to the stream
aryEnts(iLoop). BEChart.Save(me mStream,
System.Drawing. Imaging.ImageFo rmat.Png)
End If
Next
''Get beginning of stream...
memStream.Seek( 0, IO.SeekOrigin.B egin)
''...and write it all out
memStream.Write To(Response.Out putStream)

Catch ex As Exception
strMsg = ex.Message.ToSt ring
Finally
memStream.Close ()
End Try

<-end->

Has anyone taken this approach before?

I wonder if the use of the single img tag on the holder page is forcing IE
only
render one image (happens to be the last one generated in the loop).

I also wonder if the memStream is being overwritten instead of concatenated,
as
the stream position value shown in the "locals" panel seems to jump around
and
not always be at the end of the stream, which is where I would have expected
it to be...

E.g.
pass 1: capacity/length = 4706, position = 4706
pass 2: capacity/length = 4076, position = 2098
pass 3: capacity/length = 4076, position = 2062

Thanks for any help offered!

~Al
Nov 18 '05 #1
0 1159

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

Similar topics

11
5295
by: Detlef Hüttenbach | last post by:
Whereas loading tiffs and pngs from file into an Image WebControl work, the images aren't shown when loaded from streams: In a WebForm, the image's property "ImageUrl" is set to a handler, and this handler gets the image from a database. Please check the various image formats. (The images are stored in a SQL database as Image type.) I post you a demo HTTP handler below. I guess, it's the ViewState which messes up (in Windows Forms I...
0
277
by: alec maclean | last post by:
Hi, I'm trying to write a set of charts (as bitmap objects) out to a memory stream so that a variable number of charts can be displayed using just one <img> html tag in a holder page. I have everything working except that only one chart is ever displayed, no matter how many are actually created. The vb codebehind is called by being placed as the source for an img tag in a holder page. The holder
9
9775
by: charliewest | last post by:
Hello - I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#) is there any way to temporarily save an image to a session object, and after running some other operations, later retrieve the image from the session object, convert it back to an image, and re-save it to the database? Thanks?
8
3599
by: Bob | last post by:
I'm looking for an example of how to extract images from an Access 97 blob into an asp datagrid. Anybody have examples?
5
8054
by: Lee Gillie | last post by:
I am using Cryptography. You can encrypt or decrypt by providing an output stream as a parameter to the CryptoStream constructor. But I need byte arrays, as I am encrypting on the fly to a socket, and need to manage all socket traffic. My thought was a stateful call to my own Encrypt and Decrypt routines. That I would pass a MemoryStream to the CryptoStream constructor. But it appears that for each write CryptoStream does to my memory...
3
7461
by: Alan | last post by:
Hi, I'm converting a database application from Access 97 to C#/SQL Server. Old database contains some images in OLE fields. I've figured out that there's OLE header preceeding actual image data and dealt with some of the images which were in standard BMP format but most of the images are in some other format which is displayed ok in access application and can be copy/pasted to any image editor but when doubleclicking it doesn't open any...
5
15012
by: Sameer Gupta | last post by:
what are options for opening / handling tiff files in .Net framework ? which is the best library, namespace ? Please help Regards Sameer Gupta C# Designer & Developer Siemens UK
1
2439
by: san123456789 | last post by:
Hi, Im using a MS SQL server to store images... Im creating a windows form application using C#. I need to store and retrieve images from the database. This is my code to store images: pictureBox.Image = new System.Drawing.Bitmap(this.openFileDialog.FileName);
16
2585
by: haft | last post by:
I have posted this question on a javascript forum as it contains javascript code however it was believed to be an asp issue. The following head section javascript code contains the function showBigImage( isource,bigImage,header ) function call of discussion: var currentImage; function showBigImage( isource,bigImage,header ) { var theImage = document.getElementById( 'largeimage' ); theImage.src = isource;
0
9314
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
9174
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
9074
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
9015
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
7953
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...
0
5947
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();...
0
4464
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...
0
4725
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2110
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.