Seal.Model.Report.AttachImageFile C# (CSharp) Method

AttachImageFile() public method

public AttachImageFile ( string fileName ) : string
fileName string
return string
        public string AttachImageFile(string fileName)
        {
            if (ExecutionContext == ReportExecutionContext.WebReport || ExecutionContext == ReportExecutionContext.WebOutput)
            {
                return string.Format("{0}Images/{1}", WebUrl, fileName);
            }

            if (GenerateHTMLDisplay || SkipImageAttachment || IsBasicHTMLWithNoOutput || ForPDFConversion)
            {
                //Rendering the display, we return full path with file:///
                return GetImageFile(fileName);
            }

            //generating result file
            string sourceFilePath = Path.Combine(Repository.ViewImagesFolder, fileName);
            if (ForOutput)
            {
                //execution to output, rename the file and copy them in the target directory
                string targetFilePath = FileHelper.GetUniqueFileName(Path.Combine(ResultFolder, ResultFilePrefix + Path.GetFileNameWithoutExtension(fileName) + FileHelper.ResultFileStaticSuffix + Path.GetExtension(fileName)));
                File.Copy(sourceFilePath, targetFilePath);
                sourceFilePath = targetFilePath;
            }

            ExecutionAttachedFiles.Add(sourceFilePath);
            return Path.GetFileName(sourceFilePath);
        }