EFMPreview
File preview functions for images, text, and file descriptions.
Functions
GetImagePreview
Callable Loads an image file as a Texture2D with size limits.
C++
UTexture2D* GetImagePreview(const FString& FilePath, int32 MaxWidth = 256, int32 MaxHeight = 256)
| Parameter | Type | Default | Description |
|---|---|---|---|
FilePath | FString | - | Full path to the image file |
MaxWidth | int32 | 256 | Maximum width of the preview |
MaxHeight | int32 | 256 | Maximum height of the preview |
Returns: UTexture2D* preview texture, or nullptr on failure
Category: EFM|Preview
Blueprint Node
ƒGet Image Preview
File Path
Max Width
Max Height
Return Value
GetTextPreview
Pure Reads a limited preview of a text file.
C++
FString GetTextPreview(const FString& FilePath, int32 MaxLines = 10, int32 MaxCharsPerLine = 100)
| Parameter | Type | Default | Description |
|---|---|---|---|
FilePath | FString | - | Full path to the text file |
MaxLines | int32 | 10 | Maximum number of lines to read |
MaxCharsPerLine | int32 | 100 | Maximum characters per line |
Returns: Text preview string
Category: EFM|Preview
Blueprint Node
ƒGet Text Preview
File Path
Max Lines
Max Chars Per Line
Return Value
GetFileDescription
Pure Gets a human-readable description of a file.
C++
FString GetFileDescription(const FString& FilePath)
Returns: File description string (includes type, size, etc.)
Category: EFM|Preview
Blueprint Node
ƒGet File Description
File Path
Return Value
CanPreviewFile
Pure Checks if a file can be previewed.
C++
bool CanPreviewFile(const FString& FilePath)
Returns: true if the file type supports previewing
Category: EFM|Preview
Blueprint Node
ƒCan Preview File
File Path
Return Value
Example
// Get image preview for UI
Thumb = GetImagePreview("C:/images/photo.png", 128, 128)
if Thumb:
ImageBrush.SetResourceObject(Thumb)
// Get text preview
Preview = GetTextPreview("C:/logs/game.log", 5, 80)
Log(Preview)
// Check if previewable
if CanPreviewFile("C:/data/report.pdf"):
Desc = GetFileDescription("C:/data/report.pdf")
Log(Desc)