Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Advice needed: reading image (binary) data from a db, to be placed in an Image control ??

Reply
Thread Tools

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

 
 
Denise Smith
Guest
Posts: n/a
 
      11-20-2003

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


 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      11-20-2003
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.

"Denise Smith" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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
>
>



 
Reply With Quote
 
 
 
 
Denise Smith
Guest
Posts: n/a
 
      11-22-2003

Thanks for the help. I got it to work!


On Thu, 20 Nov 2003 14:33:20 -0500, "Kevin Spencer"
<(E-Mail Removed)> wrote:

>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">


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Separate Template Definition I wrote class Data in header. The C++Compiler compiled without errors. I decided to move all member functionsinto source code because they are for implementation. I do not like thatthey are placed in class body. Immortal Nephi C++ 12 07-30-2010 11:54 AM
VS2008: should data sets be placed in App_Data? dan ASP .Net 11 03-20-2008 01:51 PM
tool tip for dropdown box, placed in data grid control Vijay ASP .Net Datagrid Control 1 09-04-2006 12:33 AM
Loading Dynamic User Control Error: "The control must be placed inside a form tag with runat=server" Help Please Second time posting. davidr@sharpesoft.com ASP .Net 0 08-31-2006 05:26 PM
Problem with web server control placed on web user control okaminer ASP .Net 2 02-08-2005 03:34 PM



Advertisments