mirror of
https://github.com/Intervention/image.git
synced 2025-08-12 00:43:59 +02:00
added content-length http header field to response method
This commit is contained in:
@@ -49,15 +49,18 @@ class Response
|
|||||||
$this->image->encode($this->format, $this->quality);
|
$this->image->encode($this->format, $this->quality);
|
||||||
$data = $this->image->getEncoded();
|
$data = $this->image->getEncoded();
|
||||||
$mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
|
$mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
|
||||||
|
$length = strlen($data);
|
||||||
|
|
||||||
if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) {
|
if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) {
|
||||||
|
|
||||||
$response = \Response::make($data);
|
$response = \Response::make($data);
|
||||||
$response->header('Content-Type', $mime);
|
$response->header('Content-Type', $mime);
|
||||||
|
$response->header('Content-Length', $length);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
header('Content-Type: ' . $mime);
|
header('Content-Type: ' . $mime);
|
||||||
|
header('Content-Length: ' . $length);
|
||||||
$response = $data;
|
$response = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user