API Reference
Class
ImageEmbedding
Shared utility for image embedding functionality Used by both EmailImage and TablerCardImage to avoid code duplication
Inheritance
- Object
- ImageEmbedding
Methods
public static ImageEmbeddingResult EmbedFromFile(String filePath, Int64 maxFileSize = 0, Boolean logWarnings = false, Boolean optimize = false, Int32 maxWidth = 0, Int32 maxHeight = 0, Int32 quality = 85) #Returns:
ImageEmbeddingResultEmbeds an image from a file path as base64
Parameters
- filePath System.String
- Path to the image file
- maxFileSize System.Int64 = 0
- Maximum file size allowed for embedding (0 = no limit)
- logWarnings System.Boolean = false
- Whether to log warnings to console
- optimize System.Boolean = false
- Whether to optimize the image before encoding
- maxWidth System.Int32 = 0
- Maximum width used when optimizing
- maxHeight System.Int32 = 0
- Maximum height used when optimizing
- quality System.Int32 = 85
- JPEG quality used for optimization
Returns
ImageEmbeddingResult containing the embedding data or error info
public static ImageEmbeddingResult EmbedFromUrl(String url, Int32 timeoutSeconds = 30, Int64 maxFileSize = 0, Boolean logWarnings = false, Boolean optimize = false, Int32 maxWidth = 0, Int32 maxHeight = 0, Int32 quality = 85) #Returns:
ImageEmbeddingResultEmbeds an image from a URL as base64
Parameters
- url System.String
- URL to download and embed
- timeoutSeconds System.Int32 = 30
- Timeout for the download
- maxFileSize System.Int64 = 0
- Maximum file size allowed for embedding (0 = no limit)
- logWarnings System.Boolean = false
- Whether to log warnings to console
- optimize System.Boolean = false
- Whether to optimize the image before encoding
- maxWidth System.Int32 = 0
- Maximum width used when optimizing
- maxHeight System.Int32 = 0
- Maximum height used when optimizing
- quality System.Int32 = 85
- JPEG quality used for optimization
Returns
ImageEmbeddingResult containing the embedding data or error info
public static async Task<ImageEmbeddingResult> EmbedFromUrlAsync(String url, Int32 timeoutSeconds = 30, Int64 maxFileSize = 0, Boolean logWarnings = false, Boolean optimize = false, Int32 maxWidth = 0, Int32 maxHeight = 0, Int32 quality = 85) #Returns:
Task<ImageEmbeddingResult>Asynchronously embeds an image from a URL as base64
Parameters
- url System.String
- URL to download and embed
- timeoutSeconds System.Int32 = 30
- Timeout for the download
- maxFileSize System.Int64 = 0
- Maximum file size allowed for embedding (0 = no limit)
- logWarnings System.Boolean = false
- Whether to log warnings to console
- optimize System.Boolean = false
- Whether to optimize the image before encoding
- maxWidth System.Int32 = 0
- Maximum width used when optimizing
- maxHeight System.Int32 = 0
- Maximum height used when optimizing
- quality System.Int32 = 85
- JPEG quality used for optimization
Returns
ImageEmbeddingResult containing the embedding data or error info
public static ImageEmbeddingResult EmbedSmart(String source, Int32 timeoutSeconds = 30, Int64 maxFileSize = 0, Boolean logWarnings = false, Boolean optimize = false, Int32 maxWidth = 0, Int32 maxHeight = 0, Int32 quality = 85) #Returns:
ImageEmbeddingResultSmart embedding - auto-detects whether source is a file path or URL
Parameters
- source System.String
- File path or URL
- timeoutSeconds System.Int32 = 30
- Timeout for URL downloads
- maxFileSize System.Int64 = 0
- Maximum file size allowed for embedding (0 = no limit)
- logWarnings System.Boolean = false
- Whether to log warnings to console
- optimize System.Boolean = false
- Whether to optimize the image before encoding
- maxWidth System.Int32 = 0
- Maximum width used when optimizing
- maxHeight System.Int32 = 0
- Maximum height used when optimizing
- quality System.Int32 = 85
- JPEG quality used for optimization
Returns
ImageEmbeddingResult containing the embedding data or error info
public static String GetMimeTypeFromExtension(String extension, String filePath = "") #Returns:
StringGets MIME type from file extension
Parameters
- extension System.String
- File extension (with or without dot).
- filePath System.String = ""
- Optional file path used for context.
Returns
MIME type string
public static String GetMimeTypeFromUrl(String url) #Returns:
StringGets MIME type from URL by examining the file extension
Parameters
- url System.String
- URL to examine
Returns
MIME type string