<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\App;
use Friendica\Database\DBA;
use Friendica\DI;
+use Friendica\Model\User;
+use Friendica\Util\Proxy;
function msearch_post(App $a)
{
$perpage
);
- while($search_result = DBA::fetch($search_stmt)) {
+ while ($search_result = DBA::fetch($search_stmt)) {
$results[] = [
'name' => $search_result['name'],
'url' => DI::baseUrl() . '/profile/' . $search_result['nickname'],
- 'photo' => DI::baseUrl() . '/photo/avatar/' . $search_result['uid'] . '.jpg',
+ 'photo' => User::getAvatarUrlForId($search_result['uid'], Proxy::SIZE_THUMB),
'tags' => str_replace([',', ' '], [' ', ' '], $search_result['pub_keywords'])
];
}
+ DBA::close($search_stmt);
+
$output = ['total' => $total, 'items_page' => $perpage, 'page' => $page, 'results' => $results];
echo json_encode($output);