mirror of
https://github.com/friendica/friendica
synced 2025-04-19 08:30:11 +00:00
Merge pull request #11150 from annando/user-banner
First support for user header banner image
This commit is contained in:
commit
2c33a7803e
6 changed files with 216 additions and 60 deletions
|
@ -310,19 +310,26 @@ class Photo extends BaseModule
|
|||
}
|
||||
return MPhoto::createPhotoForExternalResource($url, 0, $mimetext);
|
||||
case "header":
|
||||
$contact = Contact::getById($id, ['uid', 'url', 'header']);
|
||||
$fields = ['uid', 'url', 'header', 'network', 'gsid'];
|
||||
$contact = Contact::getById($id, $fields);
|
||||
if (empty($contact)) {
|
||||
return false;
|
||||
}
|
||||
If (($contact['uid'] != 0) && empty($contact['header'])) {
|
||||
$contact = Contact::getByURL($contact['url'], false, ['header']);
|
||||
$contact = Contact::getByURL($contact['url'], false, $fields);
|
||||
}
|
||||
if (!empty($contact['header'])) {
|
||||
$url = $contact['header'];
|
||||
} else {
|
||||
$url = DI::baseUrl() . '/images/blank.png';
|
||||
$url = Contact::getDefaultHeader($contact);
|
||||
}
|
||||
return MPhoto::createPhotoForExternalResource($url);
|
||||
case "banner":
|
||||
$photo = MPhoto::selectFirst([], ["scale" => 3, 'uid' => $id, 'photo-type' => MPhoto::USER_BANNER]);
|
||||
if (!empty($photo)) {
|
||||
return $photo;
|
||||
}
|
||||
return MPhoto::createPhotoForExternalResource(DI::baseUrl() . '/images/friendica-banner.jpg');
|
||||
case "profile":
|
||||
case "custom":
|
||||
$scale = 4;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue