Using a constant value for the default avatar
parent
76bcf27130
commit
d9fc0ae0ea
|
@ -481,7 +481,7 @@ function dfrn_confirm_post(App $a, $handsfree = null)
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$photo = $contact['photo'];
|
$photo = $contact['photo'];
|
||||||
} else {
|
} else {
|
||||||
$photo = DI::baseUrl() . '/images/person-300.jpg';
|
$photo = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
Contact::updateAvatar($dfrn_record, $photo);
|
Contact::updateAvatar($dfrn_record, $photo);
|
||||||
|
|
|
@ -27,6 +27,7 @@ use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\Session;
|
use Friendica\Core\Session;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
|
||||||
|
@ -183,7 +184,7 @@ class Nav
|
||||||
// user info
|
// user info
|
||||||
$contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
|
$contact = DBA::selectFirst('contact', ['micro'], ['uid' => $a->user['uid'], 'self' => true]);
|
||||||
$userinfo = [
|
$userinfo = [
|
||||||
'icon' => (DBA::isResult($contact) ? DI::baseUrl()->remove($contact['micro']) : 'images/person-48.jpg'),
|
'icon' => (DBA::isResult($contact) ? DI::baseUrl()->remove($contact['micro']) : Contact::DEFAULT_AVATAR_MICRO),
|
||||||
'name' => $a->user['username'],
|
'name' => $a->user['username'],
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -132,7 +132,7 @@ class Introduction extends BaseFactory
|
||||||
'madeby_zrl' => Contact::magicLink($notification['url']),
|
'madeby_zrl' => Contact::magicLink($notification['url']),
|
||||||
'madeby_addr' => $notification['addr'],
|
'madeby_addr' => $notification['addr'],
|
||||||
'contact_id' => $notification['contact-id'],
|
'contact_id' => $notification['contact-id'],
|
||||||
'photo' => (!empty($notification['fphoto']) ? Proxy::proxifyUrl($notification['fphoto'], false, Proxy::SIZE_SMALL) : "images/person-300.jpg"),
|
'photo' => (!empty($notification['fphoto']) ? Proxy::proxifyUrl($notification['fphoto'], false, Proxy::SIZE_SMALL) : Contact::DEFAULT_AVATAR_PHOTO),
|
||||||
'name' => $notification['fname'],
|
'name' => $notification['fname'],
|
||||||
'url' => $notification['furl'],
|
'url' => $notification['furl'],
|
||||||
'zrl' => Contact::magicLink($notification['furl']),
|
'zrl' => Contact::magicLink($notification['furl']),
|
||||||
|
|
|
@ -51,6 +51,10 @@ use Friendica\Util\Strings;
|
||||||
*/
|
*/
|
||||||
class Contact
|
class Contact
|
||||||
{
|
{
|
||||||
|
const DEFAULT_AVATAR_PHOTO = '/images/person-300.jpg';
|
||||||
|
const DEFAULT_AVATAR_THUMB = '/images/person-80.jpg';
|
||||||
|
const DEFAULT_AVATAR_MICRO = '/images/person-48.jpg';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since version 2019.03
|
* @deprecated since version 2019.03
|
||||||
* @see User::PAGE_FLAGS_NORMAL
|
* @see User::PAGE_FLAGS_NORMAL
|
||||||
|
@ -644,9 +648,9 @@ class Contact
|
||||||
$fields['micro'] = $prefix . '6' . $suffix;
|
$fields['micro'] = $prefix . '6' . $suffix;
|
||||||
} else {
|
} else {
|
||||||
// We hadn't found a photo entry, so we use the default avatar
|
// We hadn't found a photo entry, so we use the default avatar
|
||||||
$fields['photo'] = DI::baseUrl() . '/images/person-300.jpg';
|
$fields['photo'] = DI::baseUrl() . self::DEFAULT_AVATAR_PHOTO;
|
||||||
$fields['thumb'] = DI::baseUrl() . '/images/person-80.jpg';
|
$fields['thumb'] = DI::baseUrl() . self::DEFAULT_AVATAR_THUMB;
|
||||||
$fields['micro'] = DI::baseUrl() . '/images/person-48.jpg';
|
$fields['micro'] = DI::baseUrl() . self::DEFAULT_AVATAR_MICRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields['avatar'] = DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix;
|
$fields['avatar'] = DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix;
|
||||||
|
@ -1467,7 +1471,7 @@ class Contact
|
||||||
*/
|
*/
|
||||||
public static function getPhoto(array $contact, string $avatar = '')
|
public static function getPhoto(array $contact, string $avatar = '')
|
||||||
{
|
{
|
||||||
return self::getAvatarPath($contact, 'photo', DI::baseUrl() . '/images/person-300.jpg', Proxy::SIZE_SMALL, $avatar);
|
return self::getAvatarPath($contact, 'photo', DI::baseUrl() . self::DEFAULT_AVATAR_PHOTO, Proxy::SIZE_SMALL, $avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1479,7 +1483,7 @@ class Contact
|
||||||
*/
|
*/
|
||||||
public static function getThumb(array $contact, string $avatar = '')
|
public static function getThumb(array $contact, string $avatar = '')
|
||||||
{
|
{
|
||||||
return self::getAvatarPath($contact, 'thumb', DI::baseUrl() . '/images/person-80.jpg', Proxy::SIZE_THUMB, $avatar);
|
return self::getAvatarPath($contact, 'thumb', DI::baseUrl() . self::DEFAULT_AVATAR_THUMB, Proxy::SIZE_THUMB, $avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1491,7 +1495,7 @@ class Contact
|
||||||
*/
|
*/
|
||||||
public static function getMicro(array $contact, string $avatar = '')
|
public static function getMicro(array $contact, string $avatar = '')
|
||||||
{
|
{
|
||||||
return self::getAvatarPath($contact, 'micro', DI::baseUrl() . '/images/person-48.jpg', Proxy::SIZE_MICRO, $avatar);
|
return self::getAvatarPath($contact, 'micro', DI::baseUrl() . self::DEFAULT_AVATAR_MICRO, Proxy::SIZE_MICRO, $avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1530,13 +1534,13 @@ class Contact
|
||||||
|
|
||||||
/// add the default avatars if the fields aren't filled
|
/// add the default avatars if the fields aren't filled
|
||||||
if (isset($contact['photo']) && empty($contact['photo'])) {
|
if (isset($contact['photo']) && empty($contact['photo'])) {
|
||||||
$contact['photo'] = DI::baseUrl() . '/images/person-300.jpg';
|
$contact['photo'] = DI::baseUrl() . self::DEFAULT_AVATAR_PHOTO;
|
||||||
}
|
}
|
||||||
if (isset($contact['thumb']) && empty($contact['thumb'])) {
|
if (isset($contact['thumb']) && empty($contact['thumb'])) {
|
||||||
$contact['thumb'] = DI::baseUrl() . '/images/person-80.jpg';
|
$contact['thumb'] = DI::baseUrl() . self::DEFAULT_AVATAR_THUMB;
|
||||||
}
|
}
|
||||||
if (isset($contact['micro']) && empty($contact['micro'])) {
|
if (isset($contact['micro']) && empty($contact['micro'])) {
|
||||||
$contact['micro'] = DI::baseUrl() . '/images/person-48.jpg';
|
$contact['micro'] = DI::baseUrl() . self::DEFAULT_AVATAR_MICRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $contact;
|
return $contact;
|
||||||
|
|
|
@ -492,9 +492,9 @@ class Photo
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($photo_failure) {
|
if ($photo_failure) {
|
||||||
$image_url = DI::baseUrl() . "/images/person-300.jpg";
|
$image_url = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
|
||||||
$thumb = DI::baseUrl() . "/images/person-80.jpg";
|
$thumb = DI::baseUrl() . Contact::DEFAULT_AVATAR_THUMB;
|
||||||
$micro = DI::baseUrl() . "/images/person-48.jpg";
|
$micro = DI::baseUrl() . Contact::DEFAULT_AVATAR_MICRO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return [$image_url, $thumb, $micro];
|
return [$image_url, $thumb, $micro];
|
||||||
|
|
|
@ -23,8 +23,8 @@ namespace Friendica\Module;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Photo as MPhoto;
|
use Friendica\Model\Photo as MPhoto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,16 +139,16 @@ class Photo extends BaseModule
|
||||||
case "profile":
|
case "profile":
|
||||||
case "custom":
|
case "custom":
|
||||||
$scale = 4;
|
$scale = 4;
|
||||||
$default = "images/person-300.jpg";
|
$default = Contact::DEFAULT_AVATAR_PHOTO;
|
||||||
break;
|
break;
|
||||||
case "micro":
|
case "micro":
|
||||||
$scale = 6;
|
$scale = 6;
|
||||||
$default = "images/person-48.jpg";
|
$default = Contact::DEFAULT_AVATAR_MICRO;
|
||||||
break;
|
break;
|
||||||
case "avatar":
|
case "avatar":
|
||||||
default:
|
default:
|
||||||
$scale = 5;
|
$scale = 5;
|
||||||
$default = "images/person-80.jpg";
|
$default = Contact::DEFAULT_AVATAR_THUMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
$photo = MPhoto::selectFirst([], ["scale" => $scale, "uid" => $uid, "profile" => 1]);
|
$photo = MPhoto::selectFirst([], ["scale" => $scale, "uid" => $uid, "profile" => 1]);
|
||||||
|
|
|
@ -29,6 +29,7 @@ use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Model\GServer;
|
use Friendica\Model\GServer;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
|
@ -369,7 +370,7 @@ class Probe
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($data['photo'])) {
|
if (empty($data['photo'])) {
|
||||||
$data['photo'] = DI::baseUrl() . '/images/person-300.jpg';
|
$data['photo'] = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($data['name'])) {
|
if (empty($data['name'])) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace Friendica\Util;
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
class Network
|
class Network
|
||||||
{
|
{
|
||||||
|
@ -235,7 +236,7 @@ class Network
|
||||||
Hook::callAll('avatar_lookup', $avatar);
|
Hook::callAll('avatar_lookup', $avatar);
|
||||||
|
|
||||||
if (! $avatar['success']) {
|
if (! $avatar['success']) {
|
||||||
$avatar['url'] = DI::baseUrl() . '/images/person-300.jpg';
|
$avatar['url'] = DI::baseUrl() . Contact::DEFAULT_AVATAR_PHOTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], Logger::DEBUG);
|
Logger::log('Avatar: ' . $avatar['email'] . ' ' . $avatar['url'], Logger::DEBUG);
|
||||||
|
|
Loading…
Reference in New Issue