Advice needed: reading image (binary) data from a db, to be placed in an Image control ??

D

Denise Smith

Hello,

I'm wondering if anyone can help me out here?

I want to be able to browse records in a database where one of the
fields contains an image.

I think I might have to extract the image to a byte array, write it to
a temp file then refer to the temp file as the URL source for the
Image control.

I've been trying this method, but I'm stuck on a couple of points.

1. The ImageURL property is not being written to the page when it gets
to the browser, and

2. I'm having trouble writing the byte array to a file on disk.

Am I going about this the wrong way?


-Denise
 
K

Kevin Spencer

You don't need to write a byte array or anything else to a disk. Just create
an ASPX page that grabs the binary data, converts it to an in-memory Bitmap,
sets the Response.ContentType property to "image/jpg" and streams the image
to the client in the Response.OutputStream. Then the URL of this ASPX page
can be the source of an HTML Image tag, as in:

<img src="image.aspx">

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top