- $data = [
- $contact['photo'] ?? '',
- $contact['thumb'] ?? '',
- $contact['micro'] ?? '',
- ];
+ // User contacts use are updated through the public contacts
+ if (($uid != 0) && !in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
+ $pcid = self::getIdForURL($contact['url'], false);
+ if (!empty($pcid)) {
+ Logger::debug('Update the private contact via the public contact', ['id' => $cid, 'uid' => $uid, 'public' => $pcid]);
+ self::updateAvatar($pcid, $avatar, $force, true);
+ return;
+ }
+ }
+
+ // Replace cached avatar pictures from the default avatar with the default avatars in different sizes
+ if (strpos($avatar, self::DEFAULT_AVATAR_PHOTO)) {
+ $fields = ['avatar' => $avatar, 'avatar-date' => DateTimeFormat::utcNow(),
+ 'photo' => DI::baseUrl() . self::DEFAULT_AVATAR_PHOTO,
+ 'thumb' => DI::baseUrl() . self::DEFAULT_AVATAR_THUMB,
+ 'micro' => DI::baseUrl() . self::DEFAULT_AVATAR_MICRO];
+ Logger::debug('Use default avatar', ['id' => $cid, 'uid' => $uid]);
+ }