Displaying Image after reading Streamed Data

S

Stephen

Hi,

I am using an Access database (OLE Object) and storing Image as a bytes
after streaming. I am able to read it back as a stream and display it on the
browser using the following code:
Response.OutputStream.Write(fileData, 0, fileData.Length)

it displays on the browser as an image, but I want to display it in an Image
(web control image) so that I can manipulate its size.
How can I do this?

Please advice,
Stephen.
 
G

Guest

My guess is that you are passing the imageID as a querystring parameter thats
how you would know what image to pull from your database. So, if this is the
case you can do this
<asp:image runat="server" id="myimage" ImageUrl="[filename].aspx?id=1" />

where filename = the aspx page that you are streaming the image file to
using the Response.output.stream. This worked for me. To play around with
the sizing you have to look at the image Thumbnail class from the
system.drawing.imaging (I think this is the namespace) and modify the image
width and height like that. What I did was to also include the width and
height as a querystring parameter so my sorce code looked something like this:
<asp:image runat="server" id="myimage"
ImageUrl="[filename].aspx?id=1&width=200&height=200" />

I suggest you create a single aspx page that handles all of the image
processing and resizing and streaming out to the browser. This single page
will be the [filename].aspx that you are setting the ImageUrl to point to.

Hope this helps.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,010
Latest member
MerrillEic

Latest Threads

Top