public ActionResult GetMoodCountImage(string userToken, string culture = "en", bool isTesting = false) { var title = culture == "en" ? "Mood Count" : "Compte d'humeur"; var data = GetEmotionCountData(userToken, culture, isTesting); Image img = StcGraphics.GetHalfDoughnutWithEmojiLegendGraph2D(data, 500, 500, title, 18); using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); return(File(ms.ToArray(), "image/jpeg")); } }
public HttpResponseMessage GetMoodCountImage(string userToken, string culture = "en") { var title = culture == "en" ? "Mood Count" : "Compte d'humeur"; var data = GetEmotionCountData(userToken, culture); Image img = StcGraphics.GetHalfDoughnutWithEmojiLegendGraph2D(data, 500, 500, title, 18); using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Jpeg); var result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new ByteArrayContent(ms.ToArray()); result.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeg"); return(result); } }