コード例 #1
0
 /// <summary>
 /// Takes the given image, converts it to a base 64 string and replaces replacementPlaceHolder in the HTML with the Image's base64 string presentation.
 /// </summary>
 /// <param name="imageFilePath">The file path of the image.</param>
 /// <param name="html">The HTML that the image needs to be injected into</param>
 /// <param name="replacementPlaceHolder">The replacement placeholder text in the HTML that needs to be replaced with the Image's base64 string presentation</param>
 /// <returns></returns>
 public static string InjectImageBase64IntoHtml(string imageFilePath, string html, string replacementPlaceHolder)
 {
     FileSystemHelper.ValidateFileExists(imageFilePath);
     byte[] imageBytes = File.ReadAllBytes(imageFilePath);
     return(InjectImageBase64IntoHtml(imageBytes, html, replacementPlaceHolder));
 }