This should be an own response which inherits from OCA\AppFramework\Http\Response: http/imageresponse.php maybe

Also please create a controller and test for it