ImageSourceResolver

final readonly class \TYPO3\CMS\Core\Resource\ImageSourceResolver

Resolves a string or object image source - a path, a combined FAL identifier, a sys_file(_reference) uid, an EXT:/PKG: system resource identifier, a system resource object (e.g. the result of <f:resource>), or an already-resolved FAL object - into a single processable resource, so consumers (the Fluid image ViewHelpers, and eventually others) do not each carry their own branching for "is this an EXT:/PKG: source or a FAL one".

An EXT:/PKG: source resolves through SystemResourceFactory::createPublicResource(), which already throws CanNotResolvePublicResourceException for a private or undeclared path before anything reads the file - the publicness check happens at resolution time, not after a stat() and getimagesize() have already run against a private file. A system resource object is resolved again from its identifier, so it passes the very same check. A plain path to a public file that is not part of any configured file storage, e.g. below typo3temp/assets/, is resolved as system resource as well. Everything else keeps resolving through ResourceFactory::resolveFileObject(), unchanged.

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
resolve()  : ProcessableFileInterface
resolvePublicFileOutsideOfFileStorages()  : SystemResourceInterface|ProcessableFileInterface|null
Resolves a plain path to an existing public file that is not part of any configured local file storage as system resource, or returns null.

Methods

resolvePublicFileOutsideOfFileStorages()

Resolves a plain path to an existing public file that is not part of any configured local file storage as system resource, or returns null.

public resolvePublicFileOutsideOfFileStorages(string $path) : SystemResourceInterface|ProcessableFileInterface|null

Only public paths of the project are considered, by default _assets/, typo3temp/assets/ and uploads/ (see config/system/resources.php), and no hidden files or files in hidden directories.

Parameters

$path : string

Return values

SystemResourceInterface|ProcessableFileInterface|null
On this page