Cheetah
Response.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Intervention\Image;
4 
5 class Response
6 {
12  public $image;
13 
19  public $format;
20 
26  public $quality;
27 
35  public function __construct(Image $image, $format = null, $quality = null)
36  {
37  $this->image = $image;
38  $this->format = $format ? $format : $image->mime;
39  $this->quality = $quality ? $quality : 90;
40  }
41 
47  public function make()
48  {
49  $this->image->encode($this->format, $this->quality);
50  $data = $this->image->getEncoded();
51  $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data);
52  $length = strlen($data);
53 
54  if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) {
55 
56  $response = \Response::make($data);
57  $response->header('Content-Type', $mime);
58  $response->header('Content-Length', $length);
59 
60  } else {
61 
62  header('Content-Type: ' . $mime);
63  header('Content-Length: ' . $length);
64  $response = $data;
65  }
66 
67  return $response;
68  }
69 }
header
</code > Be careful enabling this directive if you have a redirector script that does not use the< code > Location</code > HTTP header
Definition: URI.MungeResources.txt:10
Intervention\Image\Response\make
make()
Definition: Response.php:47
php
Intervention\Image\Response\$image
$image
Definition: Response.php:12
Intervention\Image\Image
Definition: Image.php:50
Intervention\Image\Response
Definition: Response.php:6
Intervention\Image\Response\$format
$format
Definition: Response.php:19
image
License THE YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS Definitions Adaptation means a work based upon the or upon the Work and other pre existing such as a derivative arrangement of music or other alterations of a literary or artistic or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be or adapted including in any form recognizably derived from the except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License For the avoidance of where the Work is a musical performance or the synchronization of the Work in timed relation with a moving image("synching") will be considered an Adaptation for the purpose of this License. 2. "Collection" means a collection of literary or artistic works
Intervention\Image\Response\$quality
$quality
Definition: Response.php:26
Intervention\Image\Response\__construct
__construct(Image $image, $format=null, $quality=null)
Definition: Response.php:35
Intervention\Image
Definition: AbstractColor.php:3