joym8
joym8

Reputation: 4232

Zurb Foundation rendering binary output for database image

I have a Web API action db-image that returns a HttpResponseMessage object with image bytes fetched from database:

HttpResponseMessage result = new HttpResponseMessage();
BinaryImage image = GetImage(id);
byte[] imageBytes = image.Bytes;
Stream stream = new MemoryStream(imageBytes);
result.Content = new StreamContent(stream);
result.Content.Headers.ContentType = MediaTypeHeaderValue.Parse(image.MimeType);
result.StatusCode = HttpStatusCode.OK;

When using this action with regular HTML <img> tag, the actual image is rendered

<img src="/db-image/12976/golf-course" alt="golf course" />

But when the same action url is used in a div with Zurb Foundation CSS data-interchange property, it renders binary output

<div class="bg-img-class" data-interchange="[/db-image/12976/golf-course, small], [/db-image/12976/golf-course, medium]"></div>

What am I doing wrong?

EIDT: Even the div tag is displaying the actual image when used without Zurb Foundation's interchange.

<div class="bg-img-class" style="background-image:url('/db-image/12976/golf-course')"></div>

Upvotes: 0

Views: 79

Answers (0)

Related Questions