Return image as response


I need help with a very simple problem.
I want to return an image as my response.
I’ve tried the following:

        $response->withHeader("Content-type", 'image/jpg');
        $body = $response->getBody();
       $image = file_get_contents($fname)

but the browser doesn’t recognize this as an image (it spits out the binary).
How do I return an image as a response?
I need this for an automatic image resizing. I’ve tried to use tuupola/slim-image-resize, but it is not compatible with v3.0. I am currently trying to upgrade it and I almost got it to work, except I have this annoying problem.

Help will be much appreciated.

Thank you!


Output Image from route

Darn. I should have searched better.
This was already answered:

           return $response->withHeader('Content-Type', FILEINFO_MIME_TYPE);