On some photobook page i want to show appr 20 thumbnails. These thumbnails are programatically loaded from a database. those thumbnails are already resized. When i show them the images load kinda slow. some take 0.5 seconds to load some wait for 2 secons. The database doesn't matter because when i remove the database layer, the performance issue still exists.When i load the same images directly with html the problem the images do load immediately.
Is loading images/files through the mvc framework slow or am i missing something?
This goes too slow
//in html
<img src='/File/Image.jpg' border='0'>
//in controller
public FileResult File(string ID)
{
//database connection removed, just show a pic
byte[] imageFile = System.IO.File.ReadAllBytes(ID);
return new FileContentResult(imageFile,"image/pjpeg");
}
This goes immediately
<img src='/Content/Images/Image.jpg' border='0'>