Outputting in-line image from BLOB in ASP.NET

  • Thread starter Thread starter Jonathan
  • Start date Start date
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?
 
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' ...>
 
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
 
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
 
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?
| > > >
| > > >
| > >
| > >
|
 
Back
Top