Add default profile picture path dependency
- Update default profile picture
This commit is contained in:
parent
95ffadb19f
commit
064fd922e7
4 changed files with 12 additions and 3 deletions
Binary file not shown.
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 2.6 KiB |
|
@ -14,12 +14,18 @@ class Photo
|
|||
* @var \Atlas\Pdo\Connection
|
||||
*/
|
||||
private $atlas;
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $defaultProfilePictureSmallPath;
|
||||
|
||||
public function __construct(
|
||||
\Atlas\Pdo\Connection $atlas
|
||||
\Atlas\Pdo\Connection $atlas,
|
||||
string $defaultProfilePictureSmallPath
|
||||
)
|
||||
{
|
||||
$this->atlas = $atlas;
|
||||
$this->defaultProfilePictureSmallPath = $defaultProfilePictureSmallPath;
|
||||
}
|
||||
|
||||
public function render(Request $request, Response $response, array $args): Response
|
||||
|
@ -30,7 +36,7 @@ class Photo
|
|||
);
|
||||
|
||||
if (!$data) {
|
||||
$data = file_get_contents('public/images/default-profile-sm.jpg');
|
||||
$data = file_get_contents($this->defaultProfilePictureSmallPath);
|
||||
}
|
||||
|
||||
//Try and cache our result.
|
||||
|
|
|
@ -10,7 +10,8 @@ class Photo extends BaseRoute
|
|||
public function __invoke(\Slim\Http\Request $request, \Slim\Http\Response $response, array $args): \Slim\Http\Response
|
||||
{
|
||||
return (new \Friendica\Directory\Controllers\Api\Photo(
|
||||
$this->container->atlas
|
||||
$this->container->atlas,
|
||||
$this->container->get('defaultProfilePictureSmallPath')
|
||||
))->render($request, $response, $args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -99,6 +99,8 @@ $container['http'] = function (ContainerInterface $c): GuzzleHttp\ClientInterfac
|
|||
return new GuzzleHttp\Client(['timeout' => 20, 'headers' => ['User-Agent' => 'FriendicaDirectory/' . trim($version) . ' ' . \GuzzleHttp\default_user_agent()]]);
|
||||
};
|
||||
|
||||
$container['defaultProfilePictureSmallPath'] = __DIR__ . '/../public/assets/images/default-profile-sm.jpg';
|
||||
|
||||
// Internal Dependency Injection
|
||||
|
||||
$container[\Friendica\Directory\Models\Profile::class] = function (ContainerInterface $c): Friendica\Directory\Models\Profile {
|
||||
|
|
Loading…
Reference in a new issue