473,394 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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.MemoryStream

Try
' 'Write the chart images held in the array to the output stream
For iLoop = 0 To aryEnts.GetUpperBound(0)
If Not IsNothing(aryEnts(iLoop).BEChart) Then
'Add the current chart to the stream
aryEnts(iLoop).BEChart.Save(memStream,
System.Drawing.Imaging.ImageFormat.Png)
End If
Next
''Get beginning of stream...
memStream.Seek(0, IO.SeekOrigin.Begin)
''...and write it all out
memStream.WriteTo(Response.OutputStream)

Catch ex As Exception
strMsg = ex.Message.ToString
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 1143

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

Similar topics

11
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...
0
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...
9
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...
8
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
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,...
3
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...
5
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
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: ...
16
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
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,...
0
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...
0
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...

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.