public string ReplaceObjectsandQuestions(string TheText)
        {
            string patt4   = @"\{IMPImage:[^}]*\}";
            string newtext = TheText;
            Regex  Rg4     = new Regex(patt4);

            if (TheText != "")
            {
                MatchCollection MC4 = Rg4.Matches(TheText);
                for (int i = 0; i < MC4.Count; i++)
                {
                    string ival = MC4[i].Value;
                    string iid  = ival.Split(new char[] { ':' })[1];

                    ScreenViewer.API.Elements.ImageController IC = new API.Elements.ImageController();
                    var actionResult = IC.GetImage(Convert.ToInt32(iid));

                    var response = actionResult as OkNegotiatedContentResult <Data.ScriptImage>;
                    //Assert.IsNotNull(response);
                    Data.ScriptImage theImage = response.Content;

                    string alttext    = theImage.ImageDesc;
                    string replacestr = "<img src=\\Image\\DisplayImage\\" + iid;
                    newtext = newtext.Replace(MC4[i].Value, replacestr);
                }
            }
            return(newtext);
        }
예제 #2
0
        public ActionResult DisplayImage(int ID)
        {
            ScreenViewer.API.Elements.ImageController IC = new API.Elements.ImageController();
            var actionResult = IC.GetImage(ID);

            var response = actionResult as OkNegotiatedContentResult <Data.ScriptImage>;

            //Assert.IsNotNull(response);
            Data.ScriptImage theImage = response.Content;

            var imageData = theImage.Image;

            return(File(imageData, "image/jpg"));
        }