Outputting in-line image from BLOB in ASP.NET

J

Jonathan

I have a client solution that requires data and associated files to be
stored with data in a database. As such, I have a situation where JPEG
thumbnails/images that are stored as BLOBs (image data-type) in a SQL DB
need to be written to an ASP.NET page. The BLOB is actually wrapped by a
class written in C#, BlobObj, which can return a byte-array containing the
image-bytes. I can successfully write the image to the page using the
Response.WriteBinary function, writing the byte-array return from my BlobObj
wrapper class. I cannot, though, successfully write the image to a page
with other content; the image seems to overwrite all other content. Any
ideas?
 
S

Steve C. Orr [MVP, MCSD]

This is correct. You cannot write an image directly to an HTML page. You
can only put links to images in a page.
Normally your img tag would point to a jpg or a gif image file.
In your case you'll want it to point to a special page you've designed
specifically for outputting these images.
For example:
<img src='myimage.aspx' ...>
 
J

Jonathan

Thanks! Works like a charm.

Steve C. Orr said:
This is correct. You cannot write an image directly to an HTML page. You
can only put links to images in a page.
Normally your img tag would point to a jpg or a gif image file.
In your case you'll want it to point to a special page you've designed
specifically for outputting these images.
For example:
<img src='myimage.aspx' ...>

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
 
D

dan

Has anyone tried implementing something which outputs an array of
images rather than just one???

Cheers,
dan

Thanks! Works like a charm.

Steve C. Orr said:
This is correct. You cannot write an image directly to an HTML page. You
can only put links to images in a page.
Normally your img tag would point to a jpg or a gif image file.
In your case you'll want it to point to a special page you've designed
specifically for outputting these images.
For example:
<img src='myimage.aspx' ...>

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com
wrapped by
a containing
the my
BlobObj
 
B

bruce barker

using the drawing classes, you load the images into rectangles a bitmap
using a blit, then convert the bitmap to the format of your choice. you can
also render text descriptions.

-- bruce (sqlwork.com)


| Has anyone tried implementing something which outputs an array of
| images rather than just one???
|
| Cheers,
| dan
|
|
| Jonathan wrote:
| > Thanks! Works like a charm.
| >
| > | > > This is correct. You cannot write an image directly to an HTML
| page. You
| > > can only put links to images in a page.
| > > Normally your img tag would point to a jpg or a gif image file.
| > > In your case you'll want it to point to a special page you've
| designed
| > > specifically for outputting these images.
| > > For example:
| > > <img src='myimage.aspx' ...>
| > >
| > > --
| > > I hope this helps,
| > > Steve C. Orr, MCSD, MVP
| > > http://Steve.Orr.net
| > > Hire top-notch developers at http://www.able-consulting.com
| > >
| > >
| > >
| > > | > > > I have a client solution that requires data and associated files
| to be
| > > > stored with data in a database. As such, I have a situation
| where JPEG
| > > > thumbnails/images that are stored as BLOBs (image data-type) in a
| SQL DB
| > > > need to be written to an ASP.NET page. The BLOB is actually
| wrapped by
| > a
| > > > class written in C#, BlobObj, which can return a byte-array
| containing
| > the
| > > > image-bytes. I can successfully write the image to the page
| using the
| > > > Response.WriteBinary function, writing the byte-array return from
| my
| > > BlobObj
| > > > wrapper class. I cannot, though, successfully write the image to
| a page
| > > > with other content; the image seems to overwrite all other
| content. Any
| > > > ideas?
| > > >
| > > >
| > >
| > >
|
 

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,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top