I am developing a project using asp.net mvc. And I save the images to the database as an array of bytes. Everything works fine until iam uses colorbox.
I am trying to use colorbox to display a set of product images. when I press the button, I get a strange result. I expect the image, but its collecting a huge amount of strange characters, as shown below.
<<= "= a = = →` →?!? a ?? @ # @d @ @ A) AjA A B0BrB B C: C} CDDGDDEEUEEF "FgFFG5G {GHHKHHIIcIIJ7J} JKKSKKL * LrLMMJMMN% NnNOOIOOP'PQRQQQQQQQQQQQQQQQQQQQQQQ | RSS_SSTBTTU (UuUVV \ VVWDWWX / X} XYYiYZZVZ Z [ [[\ 5 \
I am sure that it works correctly, including colorbox. The problem occurs when colorbox tries to get an image from the database. Any ideas?
Thanks in advance
public FileContentResult Index(int id) { var media = _entities.Images.AsQueryable() .Where(e => e.Id == id) .Select(e => e).FirstOrDefault(); return File(media.ImageData, media.ImageMimeType); }
this is hove, i get the image.
http://localhost:2632/assets/index/105
this is url template. to get an image.
$("a[rel=" + "'" + 48 + "']").colorbox({ transition: "fade", title: true, current: true });
this is how i call the color box.
<a style=" display:none;" rel="48" href="assets/index/107">asd</a>
this is how i insert the element into the page.
source share