Hi all I am binding the img tag as follows
- <img alt="" src='@Url.Action("UserImage", "Home")' class="avatar img-circle img-thumbnail" />
This is my code to get the image from the database
- [HttpGet]
- public ActionResult UserImage()
- {
- string user = Session["UserName"] as string;
- byte[] photo = null;
- var v = db.table.Where(p => p.USER_NAME == user).Select(img => img.PHOTO).FirstOrDefault();
- if (v != null)
- {
- photo = v;
- return File(photo, "image/jpeg");
- }
- else
- return null;
- }
This is displaying image when I have in the database but when it is null it is displaying as follows, instead of that i need to bind src tag with empty