Elgg  Version 6.3
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Elgg\Assets\ImageFetcherService Class Reference

Fetch external images server side. More...

Public Member Functions

 __construct (protected Config $config, protected SystemCache $cache, protected \ElggSession $session)
 Constructor. More...
 
 getImage (string $image_url)
 Get an image. More...
 

Protected Member Functions

 makeCacheKey (string $image_url)
 Get the cache key for a given url. More...
 
 validateImageData (string $image_data)
 Validate that the fetched image data is an actual image. More...
 

Protected Attributes

const CACHE_PREFIX = 'image_fetcher_'
 
 $client
 

Detailed Description

Fetch external images server side.

Definition at line 18 of file ImageFetcherService.php.

Constructor & Destructor Documentation

◆ __construct()

Elgg\Assets\ImageFetcherService::__construct ( protected Config  $config,
protected SystemCache  $cache,
protected \ElggSession  $session 
)

Constructor.

Parameters
Config$configconfig
SystemCache$cachethe system cache
\ElggSession$sessionthe current session

Definition at line 34 of file ImageFetcherService.php.

Member Function Documentation

◆ getImage()

Elgg\Assets\ImageFetcherService::getImage ( string  $image_url)

Get an image.

Parameters
string$image_urlthe image url to get
Exceptions

Definition at line 54 of file ImageFetcherService.php.

◆ makeCacheKey()

Elgg\Assets\ImageFetcherService::makeCacheKey ( string  $image_url)
protected

Get the cache key for a given url.

Parameters
string$image_urlthe image url
Returns
string

Definition at line 122 of file ImageFetcherService.php.

◆ validateImageData()

Elgg\Assets\ImageFetcherService::validateImageData ( string  $image_data)
protected

Validate that the fetched image data is an actual image.

Parameters
string$image_dataimage fetch result
Returns
bool

Definition at line 133 of file ImageFetcherService.php.

Member Data Documentation

◆ $client

Elgg\Assets\ImageFetcherService::$client
protected

Definition at line 25 of file ImageFetcherService.php.

◆ CACHE_PREFIX

const Elgg\Assets\ImageFetcherService::CACHE_PREFIX = 'image_fetcher_'
protected

Definition at line 20 of file ImageFetcherService.php.


The documentation for this class was generated from the following file: