return DI::baseUrl() . $default;
}
+ /**
+ * Get avatar link for given contact id
+ *
+ * @param integer $cid contact id
+ * @return string avatar link
+ */
+ public static function getAvatarForContact(int $cid):string
+ {
+ return DI::baseUrl() . '/photo/contact/'. $cid;
+ }
+
+ /**
+ * Get header link for given contact id
+ *
+ * @param integer $cid contact id
+ * @return string header link
+ */
+ public static function getHeaderForContact(int $cid):string
+ {
+ return DI::baseUrl() . '/photo/header/'. $cid;
+ }
+
/**
* Updates the avatar links in a contact only if needed
*
use Friendica\Collection\Api\Mastodon\Fields;
use Friendica\Content\Text\BBCode;
use Friendica\Database\DBA;
-use Friendica\DI;
use Friendica\Model\Contact;
use Friendica\Util\DateTimeFormat;
$this->note = BBCode::convert($publicContact['about'], false);
$this->url = $publicContact['url'];
- $this->avatar = (($userContact['photo'] ?? '') ?: $publicContact['photo']) ?: DI::baseUrl() . '/photo/contact/'. (($userContact['id'] ?? 0) ?: $publicContact['id']);
+ $this->avatar = (($userContact['photo'] ?? '') ?: $publicContact['photo']) ?: Contact::getAvatarForContact(($userContact['id'] ?? 0) ?: $publicContact['id']);
$this->avatar_static = $this->avatar;
- $this->header = DI::baseUrl() . '/photo/header/'. (($userContact['id'] ?? 0) ?: $publicContact['id']);
+ $this->header = Contact::getHeaderForContact(($userContact['id'] ?? 0) ?: $publicContact['id']);
$this->header_static = $this->header;
$this->followers_count = $apcontact['followers_count'] ?? 0;
$this->following_count = $apcontact['following_count'] ?? 0;