I am not sure if I am using the WebImage class WebImage .
I have a controller that pulls out a photo and some related information (comments, upload date, file name) from the database. I want to return a partial view containing this information and display the image along with additional information.
So, I created a new WebImage from an array of bytes, but how to display it?
According to this article, it should be quite simple.
You need to work with Razor syntax and create a variable that will be with the image:
@{ var myImage = WebImage("/Content/myImage.jpg") // Work with the image… }
Then, to load the image on the page, you must show a variable containing the image inside the HTML <img/> :
<img src="@myImage"/>
Except this doesn't work, it just prints out <img src="System.Web.Helpers.WebImage"> , and calling .Write doesn't help.
Is there a way to do this or do I need to divide my action into two different actions: one to return information about the photo, and one to return the photo?
source share