I use MVC4, Razor and C#. I would like to have Service, for example:
[WebGet]
[OperationContract]
public string Get(int id)
{
PictureManager m = new PictureManager();
Picture p = m.Load(id);
return Convert.ToBase64String(p.Trunk);
}
where:
public byte[] Trunk { get { return _trunk; } }
And on the client side I would like use it in the same way:
<img src="http://MyService/MyPictures/Get?id=21">
Is there the same ability? Or maybe I need to use some JavaScript to show a picture on client side? Could you please show me direction?
Return this from your code if your image is a jpeg.
Read here for the Data URI scheme.