I'm not really sure if I'm using the WebImage
class correctly.
I have a controller that pulls a photo and some related information (comments, upload date, file name) from the database. I want to return a partial view that contains this information, and display the image along with the extra info.
So I created a new WebImage from the byte array, but how do I display it?
According to this article it should be pretty simple
You need to work with Razor syntax and create a variable that will contain the image:
@{ var myImage = WebImage("/Content/myImage.jpg") // Work with the image… }
Then, in order to load the image in the page, you have to show the variable that contains the image inside an HTML
<img/>
tag:
<img src="@myImage"/>
Except that doesn't work, it just outputs <img src="System.Web.Helpers.WebImage">
and calling .Write
doesn't help.
Is there any way to do this or do I need to split up my action into two different actions, one to return the photo information and one to return the photo itself?