Documentation

FsImagePreviewCache extends ImagePreviewCache
in package

AbstractYes

Provide a file system cache. It is abstract as you should implement your own class for this with missing methods.

Table of Contents

Constants

MAX_DOWNLOAD_SIZE  = 3145728

Properties

$absolutePath  : mixed
$invalidateSeconds  : mixed
$prefixUrl  : mixed

Methods

__construct()  : mixed
C'tor.
allowance()  : mixed
Our image preview processor has found a thumbnail URL for a given website URL. Let's check if using this thumbnail URL is allowed by using `setAllowance`. Why? This could be a license/copyright violation and needs to be consent by the user via a custom UI.
awaitCurlMultiExecution()  : mixed
Execute all queries simultaneously, and continue when all are complete (+ closes the handles).
curlInitDownload()  : mixed
Create a curl handle which you could execute or add to a multi-curl instance which downloads a file to a given target on your filesystem.
extractImageExtension()  : mixed
Extract an extension for a given image mime-type.
get()  : mixed
See `ImagePreviewCache`.
getPrefixUrl()  : mixed
Getter.
set()  : mixed
See `ImagePreviewCache`.
getCachedFilesForUrl()  : array<string|int, string>
Get absolute pathes to already existing files for a given hash (thumbnail ID).
getCachedMetadata()  : array<string|int, mixed>|null
Check and parse the metadata file (ending with `.json`).
setBySingleResult()  : mixed
Single process a result within `$this::set()`.

Constants

Properties

Methods

__construct()

C'tor.

public __construct(string $absolutePath, string $prefixUrl[, int $invalidateSeconds = 0 ]) : mixed
Parameters
$absolutePath : string

Needs to end with /

$prefixUrl : string

Needs to end with /, there the cached file name gets appended

$invalidateSeconds : int = 0
Tags
throws
Exception

Absolute path is not writable or does not exist

allowance()

Our image preview processor has found a thumbnail URL for a given website URL. Let's check if using this thumbnail URL is allowed by using `setAllowance`. Why? This could be a license/copyright violation and needs to be consent by the user via a custom UI.

public abstract allowance(array<string|int, Thumbnail$thumbnails) : mixed
Parameters
$thumbnails : array<string|int, Thumbnail>

Key is the embed URL

awaitCurlMultiExecution()

Execute all queries simultaneously, and continue when all are complete (+ closes the handles).

public awaitCurlMultiExecution(resource|CurlMultiHandle $mh, array<string|int, CurlHandle$chs) : mixed
Parameters
$mh : resource|CurlMultiHandle
$chs : array<string|int, CurlHandle>

curlInitDownload()

Create a curl handle which you could execute or add to a multi-curl instance which downloads a file to a given target on your filesystem.

public curlInitDownload(string $url, string $target) : mixed
Parameters
$url : string
$target : string

extractImageExtension()

Extract an extension for a given image mime-type.

public extractImageExtension(string $mime) : mixed
Parameters
$mime : string

getCachedFilesForUrl()

Get absolute pathes to already existing files for a given hash (thumbnail ID).

protected getCachedFilesForUrl(string $hash) : array<string|int, string>
Parameters
$hash : string
Return values
array<string|int, string>

getCachedMetadata()

Check and parse the metadata file (ending with `.json`).

protected getCachedMetadata(string $filename) : array<string|int, mixed>|null
Parameters
$filename : string

The cached filename

Return values
array<string|int, mixed>|null

setBySingleResult()

Single process a result within `$this::set()`.

protected setBySingleResult(array<string|int, mixed> $handle, Thumbnail $thumbnail) : mixed
Parameters
$handle : array<string|int, mixed>
$thumbnail : Thumbnail

        
On this page

Search results