diff --git a/public/assets/images/default-profile-sm.jpg b/public/assets/images/default-profile-sm.jpg index ea0030e..5733602 100644 Binary files a/public/assets/images/default-profile-sm.jpg and b/public/assets/images/default-profile-sm.jpg differ diff --git a/src/classes/Controllers/Api/Photo.php b/src/classes/Controllers/Api/Photo.php index 52ae50f..d7d8572 100644 --- a/src/classes/Controllers/Api/Photo.php +++ b/src/classes/Controllers/Api/Photo.php @@ -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. diff --git a/src/classes/Routes/Http/Photo.php b/src/classes/Routes/Http/Photo.php index 6afb643..8b1e6e1 100644 --- a/src/classes/Routes/Http/Photo.php +++ b/src/classes/Routes/Http/Photo.php @@ -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); } } diff --git a/src/dependencies.php b/src/dependencies.php index ec6c5a0..5ab5608 100644 --- a/src/dependencies.php +++ b/src/dependencies.php @@ -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 {