示例#1
0
        /// <summary>
        /// Get stream as a Base64 string data.
        /// </summary>
        /// <returns>Base64 string format of image.</returns>
        public string GetBase64()
        {
            var stream = new MemoryStream();

            ImageStream.CopyTo(stream);
            stream.Seek(0, SeekOrigin.Begin);

            return(Convert.ToBase64String(stream.ToArray()));
        }
示例#2
0
        public override void ExecuteResult(ControllerContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            HttpResponseBase response = context.HttpContext.Response;

            response.ContentType = ContentType;

            ImageStream.CopyTo(response.OutputStream);
            response.End();
        }