Hopefully this is useful.
I've noticed ~120 plus cache entries of avatar_ on a dev environment with 20 fake users and 1 dev only.
Must just be me but $initials seems to be set by buildInitial() mainly called by buildAvatar() and toSvg().
Using caching and toBase64(). The cacheKey() is called before buildAvatar(), and thus buildInitial() which set $this->initials used in cacheKey().
Workaround: Calling buildAvatar() would remove the benefit of caching.
Tentative fix: Adding " $this->buildInitial(); " before calling cacheKey() seems to correct the situation.
Version 6.3.1 and Tested with 6.4.0
- File src/Avatar.php
- function toBase64()
- Line 206
public function toBase64(): string
{
if (! $this->cacheEnabled) {
// Skip cache if it's disabled
$this->buildAvatar();
return $this->image->toPng()->toDataUri();
}
$this->buildInitial();
$key = $this->cacheKeyPrefix.$this->cacheKey();
// Check if the image is in the cache
if ($base64 = $this->cache->get($key)) {
return $base64;
}
// Generate the avatar
$this->buildAvatar();
Hopefully this is useful.
I've noticed ~120 plus cache entries of avatar_ on a dev environment with 20 fake users and 1 dev only.
Must just be me but $initials seems to be set by buildInitial() mainly called by buildAvatar() and toSvg().
Using caching and toBase64(). The cacheKey() is called before buildAvatar(), and thus buildInitial() which set $this->initials used in cacheKey().
Workaround: Calling buildAvatar() would remove the benefit of caching.
Tentative fix: Adding " $this->buildInitial(); " before calling cacheKey() seems to correct the situation.
Version 6.3.1 and Tested with 6.4.0