Skip to main content


Caching avatars to files


!Friendica Admins

I've set up the avatar caching as follows:

system.avatar_cache => 1 
system.avatar_cache_path => /var/www/.../avatar/ 
system.avatar_cache_url => https\://.../avatar/ 
cache_contact_avatar => 1 

Then I moved all known avatars with
bin/console movetoavatarcache

to the subdirectory avatar/. This removed all avatar records from the photo table, and the storage subdirectory dramatically shrunk. As far as good, I think.

But now, I'd expect that new avatars won't be stored in the photo table any longer. Unfortunately this is not the case, the photo table still grows with avatar records.

In this current state, the external avatar file feature is completely useless, and it takes more storage for the files than it took in the database.

What did I miss?

in reply to alfredb

The best thing is to simply not store remote avatars locally on your server. No matter how you set up the local caching of avatars. They will need a lot of storage space.
in reply to Steffen K9 🐰

@Steffen K9 🐰 Finally, after hassling with avatars for a few hours, I decided to follow your advice and completely dropped avatar caching. 👍
in reply to alfredb

@alfredb .. something like mysqlcheck --optimize, perhaps, to free up the db space

Friendica Admins reshared this.

in reply to alfredb

Even worse, there is no way back from avatar file caching. I reverted the config to its former state, expecting to cache into the database/photo.
But according to the browser console, many avatars are not found, still looking up into the removed avatar subfolder. Arggh...
in reply to alfredb

I also went this path and with the same results a while back. However I do not experience my photo table growth, it is around 300MB currently.

I use filesystem as storage backend. When I enabled avatar caching to separate folder I got pretty much the same results but didn't like it so I removed the option and avatars resumed caching in storage folder.

I didn't like turning off avatar caching either because it significantly slowed down the feeds (maybe my server is just not too fast) and some avatars were missing because origin servers were dead. Remote avatars take a lot of space first but then it stabilizes and grows slower.