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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user