ResizeImages is used for resizing image files

Protected Properties

protected array $availableSources

availableSources to get image paths

protected string $storageFolder

storageFolder is the name of the folder in the resources disk

protected string $storageUrl

storageUrl relative or absolute URL of the Library root folder.

Public Methods

public __construct()

public __construct(): void

__construct this instance

public getContents()

public getContents($cacheKey): void

getContents performs the resize and stores in on disk, creating a cache

public getPublicPath()

public getPublicPath($imageItem): void

getPublicPath returns the public address for the resources path

public getStoragePath()

public getStoragePath($imageItem): void

getStoragePath returns a relative storage path for the image

public getTempPath()

public getTempPath(): void

getTempPath returns an internal working path

public static instance()

public static instance(): static 

instance creates a new instance of this singleton

public static resetCache()

public static resetCache(): void 

resetCache resets the resizer cache

public static resize()

public static resize(
    integer $width,
    integer $height = null,
    array $options = null,
    $options = []
): string 

resize generates and returns a thumbnail URL path

Protected Methods

protected getCache()

protected getCache(string $cacheKey): array 

getCache looks up information about a cache identifier.

protected getExistsCacheKey()

protected getExistsCacheKey($filePath): string 

getExistsCacheKey builds a key for caching the exists check

protected getResizedUrl()

protected getResizedUrl($outputFilename = 'undefined.css'): void

protected getSourcePathForResize()

protected getSourcePathForResize($realSourcePath, $tempSourcePath): void

getSourcePathForResize creates a temp copy of external files in the local filesystem

protected hasFile()

protected hasFile($imageItem): bool 

hasFile checks file exists on storage device

protected isLocalStorage()

protected isLocalStorage(): void

isLocalStorage returns true if the storage engine is local

protected prepareRequest()

protected prepareRequest(
    $width = null,
    $height = null,
    $options = []
): void

prepareRequest checks if an image has been resized before and returns the URL, otherwise the performs the resize by passing to a route that ends up at getContents

protected putCache()

protected putCache(string $cacheKey, array $cacheInfo): bool 

putCache stores information about a asset collection against a cache identifier.

protected putCacheIndex()

protected putCacheIndex(string $cacheKey): bool 

putCacheIndex adds a cache identifier to the index store used for performing a reset of the cache.