0

I have an MVC3 application that has a view with a table and links to click on to display the image. Client did not want the image to display directly in grid due to size.

I have the images stored in a SQL Server db. Every example I've seen to retrieve the byte[] from the db and display it involves saving to a file first. Is there a way to do this with a Memory Stream to Response.Write it directly and bypass the file i/o?

DavieDave
  • 1,394
  • 2
  • 18
  • 35
  • I also tried converting the byte[] to base64string and passing it on url.action, but it's giving me the URI action was too long... – DavieDave Dec 30 '12 at 20:55

1 Answers1

0

Please check this answer Display image from database in asp mvc

Instead of using the image

<img src='<%= Url.Action( "show", "image", new { id = ViewData["imageID"] } ) %>' />

use and action link

@Html.ActionLink("View Image", "Action", "Controller", new { id = ViewData["imageID"] } )

Just replace ViewData["imageID"] with the id of the image

Community
  • 1
  • 1
Esteban Elverdin
  • 3,552
  • 1
  • 17
  • 21