following examples found here I have this route
$app->get(’/fileimg/’, function (Request $request, Response $response, array $args) {
$file=“C:\data\imgs-campione\350x150.png”;
if(!file_exists($file))
die(“file:$file”);
$image = file_get_contents($file);
if ($image === false)
die(“error getting image”);
$response->write($image);
return $response->withHeader(‘Content-Type’, ‘image/png’);
});
I tried with many files of differents format
Chrome always display a blank screen with a small square in the center
firefox output a msg like : image can’t be displayed because contains errors
but if I run this code in a script outside Slim
images are outputted correctly in both browser