I'm trying to resurrect an old Symfony 2.11 project for a client who hasn't the budget for a re-write to upgrade it to something more modern. One of the routes provides raw image data in it's response
$resp = new Response($imageData);
file_put_contents('./image.jpg', $imageData);
$resp->headers->set('Content-Type', $mime);
return $resp;
The image saved to image.jpg
is valid, opens and works as expected, but when making a request the response returns the same data, but with one additional first byte - byte in hex 0A
- how can I prevent this additional byte being added as it's stopping browsers from rendering the image.
Using Symfony 2.1.11, willing to look at upgrading if it's not going to take too long or cause too many problems, but it's a pretty massive project so I'm afraid of the fallout of upgrading when it was apparently working at one point based on it's current configuration.