class ThemeImages
The logos and icons a theme sets with the Theme extender.
Each is drawn into the assets directory the way an upload would be, and drawn again only when its file's contents or its options change. A file is only read again when its size or modification time changes. What was drawn is kept in a setting, so clearing the cache doesn't draw it again. While a theme sets an image, the setting an upload of it is kept in holds the drawn file instead, when that is the kind of file an upload would be. The upload is put back when the theme stops setting the image. Files an image no longer uses are kept for 30 days, for pages and emails that still show them, and taken back if the image returns to them.
Constants
| STATE_KEY |
|
| VERSION |
Raise to draw every theme image again, after changing how they are drawn. |
| KEEP_RETIRED_FOR |
How long, in seconds, the files an image no longer uses are kept. |
| SETTINGS |
image => [setting => the drawn file it holds]. |
Properties
| protected Cloud | $assets |
|
||
| protected array<string, array{signature: string, paths: array<string, string>, email_size?: string, replaced?: array<string, mixed>}>|null | $state | What was drawn, checked once per request. |
|
|
| protected array<string, array{file: string, svg?: string| null, background?: string| null, landscape?: string| null, owner?: string| null}>|null | $config |
|
Methods
No description
An image that can't be drawn is left out until its file changes, rather than tried again, and failing, on every request.
Takes back the files drawn for an image before, if they are still kept.
Puts the drawn file in the image's settings, or the values they had before when it isn't the kind of file an upload would be.
A hash of the file's contents, read again only when its size or modification time changes.
Details
at
line 80
__construct( Container $container, SettingsRepositoryInterface $settings, Factory $filesystemFactory)
at
line 88
bool
has(string $image)
at
line 98
array
owners()
at
line 106
array
urls(string $image)
at
line 114
array
paths(string $image)
at
line 124
array|null
email(string $image)
The email copy of a theme image, as EmailLogo resolves it.
at
line 135
string|null
backgroundOf(string $image)
at
line 140
void
assertNotSet(string $image, string $field)
at
line 159
protected array
sync()
at
line 220
protected array
drawOrLeaveOut(string $image, array $options, string $signature)
An image that can't be drawn is left out until its file changes, rather than tried again, and failing, on every request.
at
line 239
protected array
retire(string $image, array $entry, int $now)
at
line 249
protected array|null
reuse(array $retired, string $image, string $signature)
Takes back the files drawn for an image before, if they are still kept.
at
line 265
protected array
draw(string $image, array $options, string $signature)
at
line 329
protected void
assertDrawable(string $image, array $options)
at
line 353
protected array
logo(string $data)
at
line 365
protected array
encodeEmail(string $data)
at
line 374
protected string
background(array $options)
at
line 379
protected string
signature(string $image, array $options)
at
line 395
protected array
replaced(string $image)
at
line 410
protected void
mirror(string $image, array $entry)
Puts the drawn file in the image's settings, or the values they had before when it isn't the kind of file an upload would be.
at
line 433
protected string|null
contents(string $file)
A hash of the file's contents, read again only when its size or modification time changes.
at
line 448
protected void
deletePaths(array $paths)
at
line 457
protected bool
isSvg(string $file)
at
line 467
protected array
config()
The images set on this request, with their callables called.