1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-01 11:30:16 +02:00

added content-length http header field to response method

This commit is contained in:
Oliver Vogel
2014-11-09 12:54:10 +01:00
parent f0d1a5a316
commit 0c9db3220b

View File

@@ -49,15 +49,18 @@ class Response
$this->image->encode($this->format, $this->quality);
$data = $this->image->getEncoded();
$mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
$length = strlen($data);
if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) {
$response = \Response::make($data);
$response->header('Content-Type', $mime);
$response->header('Content-Length', $length);
} else {
header('Content-Type: ' . $mime);
header('Content-Length: ' . $length);
$response = $data;
}