views:

15

answers:

1

Hello,

I have a SQL Server 2005 database. This database has a table named "GalleryItem". Each GalleryItem has an ID (an int) and a field called "Thumbnail" (an image). Because this field is an image type, it's stored as binary in the database.

My problem is, my user interface is pure HTML with JQuery. The user runs a query and the results are returned as JSON. Because it's JSON, I don't know how to bring the image back from the database. Is there a way to do this with JSON / JQuery that I'm not aware of? Or do I need to write the image to the disk first and then reference it via some url that I come up with?

Thank you!

A: 

You're partially correct. Essentially, what you need to do is provide a URL that can take the ID (via querystring) which is then used to query the database and get your image data. You then need to stream this image data back to the browser.

A sample of how this can be done is here: http://stackoverflow.com/questions/2482104/how-to-show-a-image-in-database-in-the-image-control-of-asp-net

lomaxx