Remote Image from api

I need help to view/resize an image from an external database (https://ninox.com/en/manual/api/rest)
With postman i could view the file.

Any suggestions?

          $ninoxkey = option('ninox.key');
          $file = Remote::get('https://api.ninoxdb.de/v1/teams/Ksphy7n9EykKByyei/Databases/xd2cvru87m5m/tables/A/records/9/files/19990514Deschoonstederonsterfelijken.jpeg', [
          'headers' => [
          $ninoxkey,
          ],

          ]);
       

What does dump($file) or echo $file give you?

dump($file) blank screen, echo Object of class Kirby\Http\Remote could not be converted to string

It’s a bit weird that dump($file) gives you a blank screen. It should return the Remote object. Please try again without the echo command.

Also I assume that $ninoxkey only contains your API key, not the Authorization header?

According to the document, you need to send the header as follows:

$file = Remote::get('PATH', [
    'headers' => [
        'Authorization' => 'Bearer ' . option('ninox.key')
    ]
]);

Using the array is an alternative syntax, using the colon was the older implementation and is still working. Personally, I’d use array syntax as well.

This seems to work, $file->content() returns a lot of gibberish binary data…

$ninoxkey = option('ninox.key');

$file = Remote::get('https://api.ninoxdb.de/v1/teams/Ksphy7n9EykKByyei/Databases/xd2cvru87m5m/tables/A/records/9/files/19990514Deschoonstederonsterfelijken.jpeg', 
[
  'headers' => [
     $ninoxkey
  ]
]);
$file_content = base64_encode ($file->content());

?>
<img src="data:image/gif;base64,<?php echo $file_content ?>" 
 alt="embedded folder icon">

There are probably other ways to convert the binary string into something useful. But the API is horribly slow, at least here.

I’m getting the same gibberish binary data…here. API is indeed very slow. Im in contact with Ninox.com for the solution on this.