Transmit mediaType for headers as well / use blank image for empty header
This commit is contained in:
parent
dd39b3203b
commit
df05d6b52a
|
@ -26,6 +26,7 @@ use Friendica\BaseDataTransferObject;
|
||||||
use Friendica\Collection\Api\Mastodon\Fields;
|
use Friendica\Collection\Api\Mastodon\Fields;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Util\DateTimeFormat;
|
use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Proxy;
|
use Friendica\Util\Proxy;
|
||||||
|
@ -115,7 +116,7 @@ class Account extends BaseDataTransferObject
|
||||||
$this->url = $publicContact['url'];
|
$this->url = $publicContact['url'];
|
||||||
$this->avatar = ($userContact['photo'] ?? $publicContact['photo']) ?: Proxy::proxifyUrl($userContact['avatar'] ?? $publicContact['avatar']);
|
$this->avatar = ($userContact['photo'] ?? $publicContact['photo']) ?: Proxy::proxifyUrl($userContact['avatar'] ?? $publicContact['avatar']);
|
||||||
$this->avatar_static = $this->avatar;
|
$this->avatar_static = $this->avatar;
|
||||||
$this->header = Proxy::proxifyUrl($userContact['header'] ?? $publicContact['header'] ?? '');
|
$this->header = Proxy::proxifyUrl($userContact['header'] ?? $publicContact['header'] ?? '') ?: DI::baseUrl() . '/images/blank.png';
|
||||||
$this->header_static = $this->header;
|
$this->header_static = $this->header;
|
||||||
$this->followers_count = $apcontact['followers_count'] ?? 0;
|
$this->followers_count = $apcontact['followers_count'] ?? 0;
|
||||||
$this->following_count = $apcontact['following_count'] ?? 0;
|
$this->following_count = $apcontact['following_count'] ?? 0;
|
||||||
|
|
|
@ -391,6 +391,14 @@ class Transmitter
|
||||||
|
|
||||||
if (!empty($contact['header'])) {
|
if (!empty($contact['header'])) {
|
||||||
$data['image'] = ['type' => 'Image', 'url' => $contact['header']];
|
$data['image'] = ['type' => 'Image', 'url' => $contact['header']];
|
||||||
|
|
||||||
|
$resourceid = Photo::ridFromURI($contact['header']);
|
||||||
|
if (!empty($resourceid)) {
|
||||||
|
$photo = Photo::selectFirst(['type'], ["resource-id" => $resourceid]);
|
||||||
|
if (!empty($photo['type'])) {
|
||||||
|
$data['image']['mediaType'] = $photo['type'];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['generator'] = self::getService();
|
$data['generator'] = self::getService();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user