tags:

views:

543

answers:

2

I have a data base with images I can get the Image tag to show in the browser but no image Is there an artical or tutorial that will show how to display Image fron database in MVC my tables have GUID userId

+1  A: 

render a view that has image links something like this

<img src="http://www.yourwebsite.com/mycontroller/renderimageaction/imageid"&gt;

in the code of mycontroller, create a renderimageaction, in it go and look for image "imageid" in the database, read the image data, and return the data to the browser as a content-type "image/jpg" or other suitable type depending on what you have stored your images as in the database

bumperbox
A: 

Generate the image source point to a web url which will query the database and put them into the response stream with correct MIME type.

With Asp.NET routing you can even do something like http://somehost/image/logo.jpg where "image" is actually an action to pull the image from DB. This way the user can preserve picture name when they save picture to their local drives.

linh1987
I'm getting the picture out of the database with the query I can't get it ot render on the page