Navigation
API > API/Runtime > API/Runtime/ImageDownload
This class manages downloading an image and swapping it out a standin once it's done.
Example (not cached): FWebImage Image; Image.SetStandInBrush(FStyle::Get()->GetBrush("Foo")); Image.BeginDownload(Url, OptionalCallback);
SNew(SImage) .Image(Image.Attr())
You may want to get your FWebImage from a FWebImageCache so we're not re-downloading the same URL all the time.
Example (cached): FWebImageCache ImageCache; // usually global ImageCache.SetStandInBrush(FStyle::Get()->GetBrush("Foo"));
SNew(SImage) .Image(ImageCache.Download(Url)->Attr())
| Name | FWebImage |
| Type | class |
| Header File | /Engine/Source/Runtime/Online/ImageDownload/Public/WebImage.h |
| Include Path | #include "WebImage.h" |
Syntax
class FWebImage : public TSharedFromThis< FWebImage >
Inheritance Hierarchy
- TSharedFromThis< FWebImage > → FWebImage
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FWebImage() |
WebImage.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FWebImage() |
WebImage.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| FOnImageDownloaded | TBaseDelegate_OneParam< void, bool > | Fired when the image finishes downloading or is canceled. | WebImage.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bDownloadSuccess | bool | Have we successfully downloaded the URL we asked for | WebImage.h | |
| DownloadedBrush | TSharedPtr< FSlateDynamicImageBrush > | The most recently downloaded and generated brush | WebImage.h | |
| DownloadTimeUtc | FDateTime | When did the download complete | WebImage.h | |
| ETag | TOptional< FString > | The ETag of the downloaded image | WebImage.h | |
| PendingCallback | FOnImageDownloaded | Callback to call upon completion | WebImage.h | |
| PendingRequest | TSharedPtr< IHttpRequest, ESPMode::ThreadSafe > | Any pending request | WebImage.h | |
| StandInBrush | TAttribute< const FSlateBrush * > | The image resource to show | WebImage.h | |
| Url | FString | The Url being downloaded | WebImage.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TAttribute< const FSlateBrush * > Attr() |
Use .Attr() to pass this brush into a slate attribute | WebImage.h | |
bool BeginDownload
(
const FString& InUrl, |
Begin downloading an image. | WebImage.h | |
bool BeginDownload
(
const FString& InUrl, |
Begin downloading an image. | WebImage.h | |
void CancelDownload() |
Cancel any download in progress | WebImage.h | |
bool DidDownloadFail() |
Has the download finished AND did it fail | WebImage.h | |
bool DidDownloadSucceed() |
Has the download finished AND was it successful | WebImage.h | |
const FSlateBrush * GetBrush() |
Get the current brush displayed (will automatically change when download completes) | WebImage.h | |
const FSlateBrush * GetDownloadedBrush() |
Only returns the downloaded brush. May be null if the download hasn't finished or was unsuccessful | WebImage.h | |
const TOptional< FString > & GetETag() |
What is the ETag of the downloaded resource | WebImage.h | |
const FString & GetUrl() |
What URL was requested | WebImage.h | |
bool IsDownloadPending() |
Is there a pending HTTP request | WebImage.h | |
FWebImage & SetStandInBrush
(
TAttribute< const FSlateBrush* > StandInBrushIn |
Set the brush that is currently being returned (this will be overridden when any async download completes) | WebImage.h |